Submitting useful Property Bag items for Health Explorer State Change Events

It’s been a while since my last post.  There has been a lot going on, and just haven’t had time to blog anything.  Actually, I have started a bunch of posts, but they are all drafted and waiting for me to finish.  Who knows when that will be!

Recently, I was tinkering around with creating a script-based, three-state monitor and realized the potential for submitting Property Bag items in a State Change Event.  State change Property Bag items are typically submitted for just that reason; using these items to change the state of the monitor.

My idea is simple, but quite useful.  Submit a Details property, with information regarding why the monitor changed state.

For example, take a look at a typical State Change Event in Health Explorer.

image

Notice the Details area.  We can see Time Sampled, Object Name, Counter Name, Instance Name, and Value.  Generally, this is likely enough information to understand why this monitor changed state, because the Operational State value explains this sufficiently.

What if the explanation is more than a few words?  What if we want to extend a little more information to the operator, and we want those details available in the State Change Events?

You could submit something like this:

'Submit Property Bag for Server, Database and Table name, high and low thresholds, and record count.
Call oBag.AddValue("DBServer",strDBServer)
Call oBag.AddValue("Database",strDatabase)
Call oBag.AddValue("Table",strTableName)
Call oBag.AddValue("LowThreshold",strLowThreshold)
Call oBag.AddValue("HighThreshold",strHighThreshold)
Call oBag.AddValue("RecordCount",strCount)
...
'Over high threshold – Submit Critical state and Details
ElseIf strCount > strHighThreshold Then
Call oBag.AddValue("State","Critical")
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 & ".")
End If

Take a look at the Health Explorer details of the monitor submitting these Property Bag items:

02

Notice the Details area.  There is a Property named Details, which was submitted with the corresponding Property Bag item above.  Basically, I’m taking the State Change Event a little further and expanding on that collected data, offering a little more information as to why the monitor changed state and formatting that information for the operator.

By submitting additional Property Bag data and presenting it in a useful way to the operator, this could be quite handy and enable the operator to more quickly identify the issue and why the state change occurred.  I continue to uncover these little gems as I work with the product every day.

We can also use this data item in Alert Description.  See this post on how to do that.