Microsoft.SystemCenter.VirtualMachineManager.2016.StoragePoolCapacityMonitorType (UnitMonitorType)

Element properties:

RunAsDefault
AccessibilityPublic
Support Monitor RecalculateFalse

Member Modules:

ID Module Type TypeId RunAs 
DataSource DataSource Microsoft.Windows.TimedScript.PropertyBagProvider Default
ErrorFilter ConditionDetection System.ExpressionFilter Default
SuccessFilter ConditionDetection System.ExpressionFilter Default
WarningFilter ConditionDetection System.ExpressionFilter Default

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$
TimeoutSecondsint$Config/TimeoutSeconds$
WarningThresholdstring$Config/WarningThreshold$
CriticalThresholdstring$Config/CriticalThreshold$

Source Code:

<UnitMonitorType ID="Microsoft.SystemCenter.VirtualMachineManager.2016.StoragePoolCapacityMonitorType" Accessibility="Public">
<MonitorTypeStates>
<MonitorTypeState ID="Error"/>
<MonitorTypeState ID="Warning"/>
<MonitorTypeState ID="Success"/>
</MonitorTypeStates>
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
<SchemaType>System!System.CommandExecuterSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TotalCapacity" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="UsedCapacity" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="WarningThreshold" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CriticalThreshold" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="WarningThreshold" Selector="$Config/WarningThreshold$" ParameterType="string"/>
<OverrideableParameter ID="CriticalThreshold" Selector="$Config/CriticalThreshold$" ParameterType="string"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="DataSource" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>StoragePoolUsage.vbs</ScriptName>
<Arguments>$Config/TotalCapacity$ $Config/UsedCapacity$ $Config/WarningThreshold$ $Config/CriticalThreshold$</Arguments>
<ScriptBody><Script>' Copyright (c) Microsoft Corporation. All rights reserved.
' VBScript source code
' StoragePoolUsage.vbs
Option Explicit

SetLocale("en-us")

' This Script is used to check if Storage pool capactiy is healthy
' If the capacity usage percentage is greater than or equal to 80% and less than 90%, output Warning
' If the capacity usage percentage is greater than or equal to 90%, output Critical
' If the capacity usage percentage is less than 80%, output healthy

Dim oArgs, oBag, oAPI, TotalCapacity, UsedCapacity,WarningThreshold, CriticalThreshold, UsagePercentage
Set oAPI = CreateObject("MOM.ScriptAPI")


' There are 4 arguments, they are the following values.
' (1) Target Property - TotalCapacity
' (2) Target Property - UsedCapacity
' (3) Target Property - WarningThreshold
' (4) Target Property - CriticalThreshold
Set oArgs = Wscript.Arguments

' Check to see if the required script arguments are there
' 4 argument are requried
' If 4 argument do not exist, log a script event
If oArgs.Count = 4 Then
Set oBag = oAPI.CreatePropertyBag()

TotalCapacity = oArgs(0)
UsedCapacity = oArgs(1)
WarningThreshold = oArgs(2)
CriticalThreshold = oArgs(3)

UsagePercentage = (Int(UsedCapacity)/Int(TotalCapacity)) * 100

Call oBag.AddValue("StoragePoolUsage", Int(UsagePercentage))
Call oBag.AddValue("WarningThreshold", WarningThreshold)
Call oBag.AddValue("CriticalThreshold", CriticalThreshold)
Call oAPI.LogScriptEvent("StoragePoolUsage.vbs", 108, 0, "StoragePoolUsage is " &amp; UsagePercentage)

Call oAPI.Return(oBag)
Else
Call oAPI.LogScriptEvent("StoragePoolUsage.vbs", 108, 0, "StoragePoolUsage was not called with 4 argument and was not executed.")
End If </Script></ScriptBody>
<SecureInput/>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<EventPolicy/>
</DataSource>
<ConditionDetection ID="ErrorFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='StoragePoolUsage']</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="Integer">$Config/CriticalThreshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="WarningFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='StoragePoolUsage']</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="Integer">$Config/WarningThreshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='StoragePoolUsage']</XPathQuery>
</ValueExpression>
<Operator>Less</Operator>
<ValueExpression>
<Value Type="Integer">$Config/CriticalThreshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</ConditionDetection>
<ConditionDetection ID="SuccessFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='StoragePoolUsage']</XPathQuery>
</ValueExpression>
<Operator>Less</Operator>
<ValueExpression>
<Value Type="Integer">$Config/WarningThreshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Error">
<Node ID="ErrorFilter">
<Node ID="DataSource"/>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Warning">
<Node ID="WarningFilter">
<Node ID="DataSource"/>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Success">
<Node ID="SuccessFilter">
<Node ID="DataSource"/>
</Node>
</RegularDetection>
</RegularDetections>
</MonitorImplementation>
</UnitMonitorType>