Microsoft.SystemCenter.VirtualMachineManager.Storage.StorageLUNCapacityMonitorType (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$
WarningThresholdint$Config/WarningThreshold$
CriticalThresholdint$Config/CriticalThreshold$

Source Code:

<UnitMonitorType ID="Microsoft.SystemCenter.VirtualMachineManager.Storage.StorageLUNCapacityMonitorType" 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="RemainingCapacity" 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"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ThinlyProvisioned" type="xsd:string"/>
</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="int"/>
<OverrideableParameter ID="CriticalThreshold" Selector="$Config/CriticalThreshold$" ParameterType="int"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="DataSource" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>StorageLUNUsage.vbs</ScriptName>
<Arguments>$Config/TotalCapacity$ $Config/RemainingCapacity$ $Config/WarningThreshold$ $Config/CriticalThreshold$ $Config/ThinlyProvisioned$</Arguments>
<ScriptBody><Script>' Copyright (c) Microsoft Corporation. All rights reserved.
' VBScript source code
' StorageLUNCapacity.vbs
Option Explicit

SetLocale("en-us")

' This Script is used to check if Storage lun capacity 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, RemainingCapacity, UsedCapacity, WarningThreshold, CriticalThreshold, UsagePercentage, ThinlyProvisioned
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
' (5) Target Property - ThinlyProvisioned
Set oArgs = Wscript.Arguments

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

TotalCapacity = oArgs(0)
RemainingCapacity = oArgs(1)
WarningThreshold = oArgs(2)
CriticalThreshold = oArgs(3)
ThinlyProvisioned = oArgs(4)
'For Fixed LUNs don't raise the alert , set UsedCapacity explicitly to 0
If (ThinlyProvisioned = "false" OR ThinlyProvisioned = "False") Then
UsedCapacity = 0
Else
UsedCapacity = TotalCapacity - RemainingCapacity
End If

If TotalCapacity &gt; 0 Then
UsagePercentage = CLng((UsedCapacity/TotalCapacity) * 100)

Call oBag.AddValue("StorageLUNCapacity", CInt(UsagePercentage))
Call oBag.AddValue("WarningThreshold", WarningThreshold)
Call oBag.AddValue("CriticalThreshold", CriticalThreshold)
Else
Call oAPI.LogScriptEvent("StorageLUNUsage.vbs", 108, 0, "TotalCapacity invalid." &amp; TotalCapacity)
End If

Call oAPI.Return(oBag)
Else
Call oAPI.LogScriptEvent("StorageLUNUsage.vbs", 108, 0, "StorageLUNCapacity was not called with 5 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='StorageLUNCapacity']</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='StorageLUNCapacity']</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="Integer">$Config/WarningThreshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='StorageLUNCapacity']</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='StorageLUNCapacity']</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>