MSSQL 2012: WMI Property Check

Microsoft.SQLServer.2012.WMIAdvancedPropertyProvider (UnitMonitorType)

This monitor type checks an SQL WMI property against a specified expected value.

Element properties:

RunAsMicrosoft.SQLServer.SQLDefaultAccount
AccessibilityInternal
Support Monitor RecalculateFalse

Member Modules:

ID Module Type TypeId RunAs 
DataSource DataSource Microsoft.Windows.WmiProvider Default
BadFilter ConditionDetection System.ExpressionFilter Default
GoodFilter ConditionDetection System.ExpressionFilter Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Interval (sec)
GoodValuestring$Config/GoodValue$Good Value

Source Code:

<UnitMonitorType ID="Microsoft.SQLServer.2012.WMIAdvancedPropertyProvider" Accessibility="Internal" RunAs="SQL!Microsoft.SQLServer.SQLDefaultAccount">
<MonitorTypeStates>
<MonitorTypeState ID="ValueGood"/>
<MonitorTypeState ID="ValueBad"/>
</MonitorTypeStates>
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComputerName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SQLServiceName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PropertyName" type="xsd:string"/>
<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="GoodValue" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" ParameterType="int" Selector="$Config/IntervalSeconds$"/>
<OverrideableParameter ID="GoodValue" ParameterType="string" Selector="$Config/GoodValue$"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource TypeID="Windows!Microsoft.Windows.WmiProvider" ID="DataSource">
<NameSpace>\\$Config/ComputerName$\root\Microsoft\SQLServer\ComputerManagement11</NameSpace>
<Query>SELECT * FROM SQLServiceAdvancedProperty WHERE ServiceName = '$Config/SQLServiceName$' AND PropertyName = '$Config/PropertyName$'</Query>
<Frequency>$Config/IntervalSeconds$</Frequency>
</DataSource>
<ConditionDetection TypeID="System!System.ExpressionFilter" ID="GoodFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='PropertyNumValue']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Config/GoodValue$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection TypeID="System!System.ExpressionFilter" ID="BadFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='PropertyNumValue']</XPathQuery>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value>$Config/GoodValue$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="ValueGood">
<Node ID="GoodFilter">
<Node ID="DataSource"/>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="ValueBad">
<Node ID="BadFilter">
<Node ID="DataSource"/>
</Node>
</RegularDetection>
</RegularDetections>
</MonitorImplementation>
</UnitMonitorType>