Freigeben über


Populating an Alert Description with PropertyBag data

If you are running a script via a rule, and that script returns a propertybag, then it is possible you'll want the data returned to show up in the alert description assuming an alert is generated. The syntax for this in OpsMgr 2007 isn't that straight forward, but with some assistance we figured it out.

Here is what the proper syntax is for the alert description: $Data/Property[@Name='ret']$

Here is an example of the script that returns a PropertyBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
strReturn = "Test"
Call oBag.AddValue("ret",strReturn)
Call oAPI.Return(oBag)
Call oAPI.LogScriptEvent("TestScript.vbs", 9999, 0, strReturn)

Comments

  • Anonymous
    October 12, 2007
    PingBack from http://www.artofbam.com/wordpress/?p=8034

  • Anonymous
    October 29, 2007
    The comment has been removed

  • Anonymous
    October 29, 2007
    Update: It seems that you can only use the $Data/Property[@Name='ret']$ in a Monitor and not a Rule. Am I correct? Regards, Stefan Stranger http://weblog.stranger.nl

  • Anonymous
    October 30, 2007
    The syntax for a monitor should be: $Data/Context/Property[@Name='ret']$ The syntax for a rule should be: $Data/Property[@Name='ret']$

  • Anonymous
    January 14, 2008
    I'm trying to populate an alert description for a monitor using the $Data/Context/Property[@Name='something']$ syntax but the resultant text has {0} {1} {2} etc where my variable data is supposed to be. Any idea what's wrong? I have verified that the property bag values are set properly in the alert context tab of the alert properties display. Thanks.

  • Anonymous
    January 14, 2008
    You probably have more than 10 parameters.  I talk about this here: http://blogs.msdn.com/rslaten/archive/2007/10/31/snmpvarbinds-and-the-alert-description-field-in-opsmgr-2007.aspx

  • Anonymous
    January 14, 2008
    No. I don't have more than 10 parameters in the description. In fact here is the description: The process $Data/Context[@Name='Process']$ is not running properly. The number of instances is suposed to be $Data/Context[@Name='Operator']$ to $Data/Context[@Name='Count']$. The actual number of instances was $Data/Context[@Name='ActualCount']$. Now do you mean more than 10 parameter defined in the property bag via addvalue? Even then I have only 6 key:value pairs. Any other ideas? Thanks.

  • Anonymous
    February 24, 2009
    Over a year ago I blogged about the proper syntax required to populate an alert description with data