Windows Service Not Running State with consecutive samples threshold monitor type

Microsoft.SystemCenter.2007.WindowsServiceNotRunningState.ConsecutiveSamplesThreshold.MonitorType (UnitMonitorType)

This monitor type provides the capability to check the state of a window service by using a sample count threshold.

Element properties:

RunAsDefault
AccessibilityPublic
Support Monitor RecalculateTrue

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.Scheduler Default
Probe ProbeAction Microsoft.Windows.Win32ServiceInformationProbe Default
CD1 ConditionDetection System.Performance.ConsecutiveSamplesCondition Default
CDSufficientSamples ConditionDetection System.ExpressionFilter Default
Mapper ConditionDetection System.Performance.DataGenericMapper Default
ServiceNotRunning ConditionDetection System.ExpressionFilter Default
ServiceRunning ConditionDetection System.ExpressionFilter Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Interval SecondsInterval in seconds at which the service state is checked.
Thresholddouble$Config/Threshold$ThresholdSample count to wait until change the monitor to the not running state.

Source Code:

<UnitMonitorType ID="Microsoft.SystemCenter.2007.WindowsServiceNotRunningState.ConsecutiveSamplesThreshold.MonitorType" Accessibility="Public">
<MonitorTypeStates>
<MonitorTypeState ID="NotRunning"/>
<MonitorTypeState ID="Running"/>
</MonitorTypeStates>
<Configuration>
<xsd:element name="ComputerName" type="xsd:string"/>
<xsd:element name="ServiceName" type="xsd:string"/>
<xsd:element name="IntervalSeconds" type="xsd:integer"/>
<xsd:element minOccurs="1" name="Threshold" type="xsd:double"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="Threshold" Selector="$Config/Threshold$" ParameterType="double"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/IntervalSeconds$</Interval>
<SyncTime/>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="Probe" TypeID="Windows!Microsoft.Windows.Win32ServiceInformationProbe">
<ComputerName>$Config/ComputerName$</ComputerName>
<ServiceName>$Config/ServiceName$</ServiceName>
</ProbeAction>
<ConditionDetection ID="ServiceRunning" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='State']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Integer">4</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="ServiceNotRunning" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='State']</XPathQuery>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value Type="Integer">4</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="Mapper" TypeID="Performance!System.Performance.DataGenericMapper">
<ObjectName>WindowsService</ObjectName>
<CounterName>ServiceState</CounterName>
<InstanceName>$Config/ServiceName$</InstanceName>
<Value>1</Value>
</ConditionDetection>
<ConditionDetection ID="CD1" TypeID="Performance!System.Performance.ConsecutiveSamplesCondition">
<Threshold>1</Threshold>
<Direction>greaterequal</Direction>
</ConditionDetection>
<ConditionDetection ID="CDSufficientSamples" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Double">Value</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="Double">$Config/Threshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Running">
<Node ID="ServiceRunning">
<Node ID="Probe">
<Node ID="DS"/>
</Node>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="NotRunning">
<Node ID="CDSufficientSamples">
<Node ID="CD1">
<Node ID="Mapper">
<Node ID="ServiceNotRunning">
<Node ID="Probe">
<Node ID="DS"/>
</Node>
</Node>
</Node>
</Node>
</Node>
</RegularDetection>
</RegularDetections>
<OnDemandDetections>
<OnDemandDetection MonitorTypeStateID="Running">
<Node ID="ServiceRunning">
<Node ID="Probe"/>
</Node>
</OnDemandDetection>
<OnDemandDetection MonitorTypeStateID="NotRunning">
<Node ID="ServiceNotRunning">
<Node ID="Probe"/>
</Node>
</OnDemandDetection>
</OnDemandDetections>
</MonitorImplementation>
</UnitMonitorType>