SCOM: Create an Alert on an Object Property Status

Today I had an interesting question from one of my customer. Is it possible to create a SCOM alert based on an SCOM Object Property?

In clear, They would like to get a SCOM Alert when a DHCP Scope is deactivated (or Disabled). If you check the DHCP Scope properties, this information is already there and we ‘just’ need to monitor the changes of this property.

image

Unfortunately, this monitor doesn’t exist in the DHCP MP, only the following 3 monitors are available out of the box.image

So we need to create a new monitor that will timely check the IsEnabled property of each DHCP Scopes and if the value is False, raise an alert.

Go to the authoring section and create a new unit monitor.
image

Select Time Script Two State Monitor.image

As Monitor Target, specify DHCP Scope.image

Define the schedule for your monitor.
image

There are 3 steps that you need to do:
_Provide a name .vbs to your script.
_Copy/Paste the script below

image

Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

iScopeStatus = WScript.Arguments(0)

If iScopeStatus = "True" Then
   Call oBag.AddValue("Status","OK")
Else
   Call oBag.AddValue("Status","NOK")
End If

Call oAPI.Return(oBag)

 

When done, click on Parameters… and select the Is Enabled parameter.image

Configure the Unhealthy Expression:

_Parameter Name: Property[@Name=’Status’]
_Value: NOK

image

Configure the Healthy Expression:

_Parameter Name: Property[@Name=’Status’]
_Value: OK

image

Define the Monitor Health State for the Unhealthy Monitor Condition.image

Finally, configure the Alert Settings.
image

Now the problem with this approach is that the monitor is looking to a value that has been set by a Discovery Script. Which means that if your DHCP Scope Discovery script is only running one time per day, the IsEnabled property will be refreshed only one time per day.

So in this case, we will need to change the DHCP Scope Discovery interval to match our monitor interval. Go to the authoring section, search for ‘scopes discovery’

image

Select DHCP Technical Preview Scopes Discovery Data Source With Paging and create an Override For All objects of class: Microsoft Windows Server DHCP Technical Previewimage

Decrease the interval seconds to match to the monitor we createdimage

After a few minutes, we could see that my disabled DHCP Scope is turning Red.
image

If we compare Health Explorer Status of my two DHCP Scopes (One enabled and one disabled), we could confirm that the monitor is working as expected Smile

image

You could download the management pack here:https://www.vnext.be/wp-content/uploads/2015/12/VNEXTLAB.DHCP_.Scope_.Monitor1.zip

Christopher

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Email this to someoneShare on TumblrPin on PinterestDigg thisShare on RedditFlattr the authorBuffer this pageShare on StumbleUpon

About Christopher Keyaert

Christopher Keyaert is a Consultant, focused on helping partners to leverage the System Center and Microsoft Azure cloud platform. He is also a Microsoft Most Valuable Professional (MVP) for Cloud and Data Center Management and a Microsoft Certified Trainer (MCT).
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to SCOM: Create an Alert on an Object Property Status

  1. NicklasW says:

    Thank you!.. Great article Christopher..

Leave a Reply

Your email address will not be published. Required fields are marked *