Jump to content
Sign in to follow this  
t-zwck

Using a property bag to populate an alert description

Recommended Posts

Using a property bag to populate an alert description

 

Lets say you have an application that creates an event (we'll use event 9999 as an example) when it has a certain problem. You want to get alerted when this event occurs, but you want to do some additional diagnostics before the alert is generated and populate the alert description with information collected from the diagnostics. I have put a diagram of this scenario below:

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

I have listed each step that I used to create this management pack below.

 

Step 1 - Create and name a new management pack in the Authoring Console

 

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 2 - Create a new composite data source

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 3 - Add the Microsoft.Windows.EventProvider member module to the data source

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 4 - Configure the member module to look for an event id from the application event log where the id = a parameter that is passed in.

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 5 - Add the Microsoft.Windows.ScriptPropertyBagProbe member module to the data source

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 6 - Configure the member module to accept parameters for the script name, arguments, and script body. In my example I hard code the script timeout to 30 seconds but you can also make this configurable via a parameter.

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 7 - Set the order of the member modules so the EventProvider runs first, the ScriptProvider runs second, and the Module Output is last.

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 8 - Add all of the parameters that need to be passed into this data source. Your data source is now complete.

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 9 - Create a new custom rule in the Authoring Console. I am targeting my rule to Microsoft.Windows.Computer for example purposes.

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 10 - On the Modules tab, add our custom data source and then click "Edit" to configure the parameters we want to pass to this data source. My ScriptBody parameter contains a very simple VBScript that returns a string that I want to have appear in the alert description ("This is the information that I collected for my alert"). In the real world this string would obviously be additional useful information that was gathered by the vbscript. I use notepad as my XML editor so this is what my configuration looks like.

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 11 - After the data source is configured go back to the Modules tab and add a new action of type System.Health.GenerateAlert. Once added click "Edit" and then "Configure" to pull up the Alerting User Interface. Now fill in the appropriate fields for the alert. Notice that the Alert description xpath is looking for the value in the property bag which is populated in the vbscript which we configured in the last step. After this step your rule should be created.

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 12 - Import the MP and create an event of 9999 in the application event log on an agent

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

Step 13 - View the alert generated to ensure it contains the string from the VBScript

 

Hidden Content

    Give reaction to this post to see the hidden content.

 

I hope this example helps explain how information from a property bag can appear in an alert description and might also be a good introduction to the authoring console for some. I have attached the MP that was created by these steps for your reference.

Share this post


Link to post
Share on other sites

Hidden Content

    Give reaction to this post to see the hidden content.

 

thumbs up

 

thank you

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...