Best Practice: Alerts should use correct XPathconstructs


What does this best practice check for?

Often times, monitors raise alerts when the monitor goes into an unhealthy state. When such alerts are defined inside the management pack XML, these alerts must be able to access data inside the monitor in order to be functional. As a best practice, when an alert makes references to the monitor data, is should use the construction “$Data/Context/< Xpath>” instead of $Data/< Xpath>.

Why is it important to follow this best practice? What is the impact of not following this best practice?

If the incorrect construct is used, the alert will not be able to access the necessary data from the monitor. As a result, the alert will not be raised.

How do I fix this in my MP?

Using the Authoring Console:

1.        The Authoring Console will automatically create XPathreferences that use the correct constructs.


Using XML:

       < WriteActions >

         < WriteAction ID = " WriteToDB" TypeID =" SC!Microsoft.SystemCenter.CollectEvent" />

         < WriteAction ID = " WriteToCertSvcEvents" TypeID =" Microsoft.Windows.CertificateServices.CARole.CertSvcEvents.Publisher" />

         < WriteAction ID = " Alert" TypeID =" Health!System.Health.GenerateAlert" >

           < Priority > 2 </ Priority >

           < Severity > 2 </ Severity >

            < AlertMessageId > $MPElement[Name="AlertMessageID4f12f8d124ed4ece99544c9a9730fa37"]$ </ AlertMessageId >

           < AlertParameters >

< AlertParameter1 > $Data/Context/EventDescription$ </ AlertParameter1 >

           </ AlertParameters >

</ WriteActions >