MSSQL 2016: Server-Windows-Dienst

Microsoft.SQLServer.2016.CheckWinServiceStateMonitorType (UnitMonitorType)

Der Monitortyp zum Erkennen des Status des SQL Server-Windows-Diensts.

Element properties:

RunAsMicrosoft.SQLServer.MonitoringAccount
AccessibilityInternal
Support Monitor RecalculateFalse

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.WmiProvider Default
CheckServiceState ProbeAction Microsoft.SQLServer.2016.VerifyWindowsServiceState Default
ServiceNotRunning ConditionDetection System.ExpressionFilter Default
ServiceRunning ConditionDetection System.ExpressionFilter Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
Frequencyint$Config/Frequency$Intervall (Sekunden)Das periodische Intervall in Sekunden, in dem der Workflow ausgeführt werden soll.
CheckStartupTypestring$Config/CheckStartupType$Nur warnen, wenn der Starttyp des Diensts automatisch erfolgtDieser Parameter kann auf "true" (wahr) oder "false" (falsch) festgelegt werden. Ist dieser Parameter auf "false" festgelegt, bleibt die aktuelle Starttypeinstellung des Diensts vom Workflow unberücksichtigt. Der Standardwert ist "true".
UnavailableTimeint$Config/UnavailableTime$Nicht verfügbare Zeit (Sekunden)Die minimale Dauer der Dienstunterbrechung, um diese als fehlerhaft anzusehen.

Source Code:

<UnitMonitorType ID="Microsoft.SQLServer.2016.CheckWinServiceStateMonitorType" Accessibility="Internal" RunAs="GPMP!Microsoft.SQLServer.MonitoringAccount">
<MonitorTypeStates>
<MonitorTypeState ID="Running" NoDetection="false"/>
<MonitorTypeState ID="NotRunning" NoDetection="false"/>
</MonitorTypeStates>
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Frequency" type="xsd:integer"/>
<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="ServiceName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CheckStartupType" minOccurs="0" maxOccurs="1" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="UnavailableTime" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="Frequency" Selector="$Config/Frequency$" ParameterType="int"/>
<OverrideableParameter ID="CheckStartupType" Selector="$Config/CheckStartupType$" ParameterType="string"/>
<OverrideableParameter ID="UnavailableTime" Selector="$Config/UnavailableTime$" ParameterType="int"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.WmiProvider">
<NameSpace>\\.\Root\cimv2</NameSpace>
<Query>SELECT StartMode, State FROM Win32_Service WHERE Name = '$Config/ServiceName$'</Query>
<Frequency>$Config/Frequency$</Frequency>
</DataSource>
<ProbeAction ID="CheckServiceState" TypeID="Microsoft.SQLServer.2016.VerifyWindowsServiceState">
<ServiceName>$Config/ServiceName$</ServiceName>
<ServiceUnavailableTime>$Config/UnavailableTime$</ServiceUnavailableTime>
<CheckStartupType>$Config/CheckStartupType$</CheckStartupType>
<StartMode>$Data/Property[@Name='StartMode']$</StartMode>
<State>$Data/Property[@Name='State']$</State>
</ProbeAction>
<ConditionDetection ID="ServiceRunning" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='ServiceState']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Running</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="ServiceNotRunning" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='ServiceState']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">NotRunning</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Running">
<Node ID="ServiceRunning">
<Node ID="CheckServiceState">
<Node ID="DS"/>
</Node>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="NotRunning">
<Node ID="ServiceNotRunning">
<Node ID="CheckServiceState">
<Node ID="DS"/>
</Node>
</Node>
</RegularDetection>
</RegularDetections>
</MonitorImplementation>
</UnitMonitorType>