Best Practice: Alerts should reference existing parameters

 

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, alerts should be sure to reference parameters that exist inside the monitor.  

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

If the parameters that are referenced do not actually exist, the alert will not be functional, and will never be raised in the Operations Console.

How do I fix this in my MP?

Using the Authoring Console:

1.        If you change the properties of a monitor to generate an alert, the Authoring Console will automatically pick the correct set of parameters.

 

Using XML:

     < UnitMonitor ID = " Microsoft.Windows.HyperV.2008.Services.ImageManagementServiceMonitor" Accessibility =" Public" Enabled =" onEssentialMonitoring" Target =" HVDisc!Microsoft.Windows.HyperV.2008.ServerRole" ParentMonitorID =" Health!System.Health.AvailabilityState" Remotable =" true" Priority =" Normal" TypeID =" Windows!Microsoft.Windows.CheckNTServiceStateMonitorType" ConfirmDelivery =" false" >

       < Category > StateCollection </ Category >

       < AlertSettings AlertMessage = " Microsoft.Windows.HyperV.2008.Services.ImageManagementServiceMonitor.Alert" >

         < AlertOnState > Error </ AlertOnState >

         < AutoResolve > true </ AutoResolve >

         < AlertPriority > Normal </ AlertPriority >

         < AlertSeverity > Error </ AlertSeverity >

         < AlertParameters >

            < AlertParameter1 > $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$ </ AlertParameter1 >

         </ AlertParameters >

       </ AlertSettings >

       < OperationalStates >

         < OperationalState ID = " ServiceHealthy" MonitorTypeStateID =" Running" HealthState =" Success" />

         < OperationalState ID = " ServiceNotHealthy" MonitorTypeStateID =" NotRunning" HealthState =" Error" />

       </ OperationalStates >

       < Configuration >

          < ComputerName > $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$ </ ComputerName >

         < ServiceName > vhdsvc </ ServiceName >

         < CheckStartupType > false </ CheckStartupType >

       </ Configuration >

     </ UnitMonitor >