Submitting useful Property Bag items for Alert Description
In a previous post, I gave an example of how to submit useful information, by means of a Property Bag, to extend more information to an operator while viewing State Change Events in Health Explorer.
Another interesting part of submitting this information in a nicely formatted data item, is that this data item can also be used in the Alert Description.
Just to recap from the previous post, the Property Bag name-value pair we are submitting is:
Call oBag.AddValue("Details","The number of records in the " & strTableName & " table in " & strDBServer & _
" / " & strDatabase & " database has exceeded Critical threshold: " & strHighThreshold & "." & _
"Current record count is " & strCount & ".")
So, instead of configuring the Alert Description like:
The number of records in the $Data/Context/DataItem/Property[@Name='Table']$ table in the $Data/Context/DataItem/Property[@Name='DBServer']$ / $Data/Context/DataItem/Property[@Name='Database']$ database has exceeded the critical threshold: $Data/Context/DataItem/Property[@Name='HighThreshold']$. Current record count is: $Data/Context/DataItem/Property[@Name='RecordCount']$.
…we can configure the Alert Description by simply using the Data Item passed into the workflow via the Property Bag:
$Data/Context/DataItem/Property[@Name='Details']$
As you can see, by creating a Details property bag and formatting those details in the script, we can take some of the confusion out of formatting these alert descriptions in the GUI.
All we need to know is, there is a Data Item passed to this workflow that has the formatted details. And that Data Item is:
$Data/Context/DataItem/Property[@Name='Details']$
The final result of using this data item in the Alert Description is:
And, from my previous post, we also used this data item for the State Change Event:
Comments
Anonymous
January 01, 2003
The script name can be written to the first parameter in the event details. For example, Call oAPI.LogScriptEvent("ScriptName.vbs",EventIdInteger,LevelInteger,"This is additional event details.").Anonymous
January 01, 2003
Great post Jonathan! I'm curious, does anyone know how to get the monitor name of a two-state script monitor into the alert description? I can obviously hard code it in the description but was wondering if it can be done via variables. I'd like to be able to log the script name when I use the oAPI.LogScriptEvent.Anonymous
January 01, 2003
Can you be a little more specific about what you're trying to do? This post is about gathering pieces of information through a script and creating a description string, which is submitted as a single "Description" property bag.Anonymous
January 01, 2003
Hi Jonathan, lovely idea and worked like a charm. Thanks a lot, Jose Fehse MCITP, MCSEAnonymous
January 01, 2003
What do you see for this alert when you run get-alert? You should be able to submit those data items to the alert descripion as name/value pairs.Anonymous
September 01, 2009
I am trying to pass information from Alert Context to the Alert Description. I saw this great post of yours. Do you have any idea how to do that? Thank you for your great post.Anonymous
September 02, 2009
The comment has been removed