Règle d’échec de script de détection d’AlwaysOn

Microsoft.SQLServer.2012.AlwaysOn.ScriptFailedRule (Rule)

Cette règle détecte l’ID d’événement 4101 et crée une alerte

Knowledge Base article:

Résumé

Règle de détection d’événement d’échec de script AlwaysOn

Causes

L’exécution du script peut échouer en raison de toute exception à l’intérieur du script, ainsi que d’exceptions dans les appels d’applets de commande qui ne sont pas traités en continu.

Solutions

La description et le Contexte de l’alerte contiennent des informations indiquant la règle ou le moniteur ayant échoué.

Element properties:

TargetMicrosoft.SQLServer.2012.AlwaysOn.AlwaysOnSeed
CategoryAlert
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
Échec du script de détection d’AlwaysOn
Échec du script de détection d’AlwaysOn. Motif : {0}
Event LogOperations Manager

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.EventProvider Default
Alert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.2012.AlwaysOn.ScriptFailedRule" Enabled="true" Target="Microsoft.SQLServer.2012.AlwaysOn.AlwaysOnSeed" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Alert</Category>
<DataSources>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.EventProvider">
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</ComputerName>
<LogName>Operations Manager</LogName>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="UnsignedInteger">4101</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventLevel</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="UnsignedInteger">2</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="Alert" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>2</Severity>
<AlertOwner/>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2012.AlwaysOn.ScriptFailedRule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>