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:
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:
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:
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.
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.
What I am trying to do is I have a Custom Monitor that detects a hardware problem in a unix box. When it is sending an alert out the alert context have most of the information about the hardware failure. How would I pull information out of the "Alert Context" field to the "Alert Description" field?
Server A HWDiag has indicated an error has occurred.
omativlab-sun3|UEH_HWDiag Test:test|CRITICAL|(CRITICAL) UEH_HWDiag test failure|090828b|UEH_HWDiag Test|test|T-EventMgmtOps|False|OFF-LINE|FALSE|UEH_HWDiag|1090902133932492|test|/tmp/UEH_HWDiag.test exists
Thank you very much for you time.
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.
Hi Jonathan, lovely idea and worked like a charm.
Thanks a lot,
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.
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.").