How to Add Overridable Parameters to a SCOM Monitor Type

How to Add Overridable Parameters to a SCOM Monitor Type

When you create a monitor unit in SCOM you need to specify a monitor type that defines the schema, operation, parameters of the monitor. But sometimes you need more parameters or functionalities than default monitor types provided by Microsoft for example.

In this case, a client needed the possibility to override thresholds values of a custom management pack monitor directly from the console. At first, it was not possible because the monitor was based on standard Microsoft monitor type: Microsoft.Windows.TimedScript.ThreeStateMonitorType. This monitor type as indicated by his name is a three state monitor used to run a script against a specific target to retrieve specific values. Additionally, this monitor type is based on the standard data source module type Microsoft.Windows.TimedScript.PropertyBagProvider.

In order to add the possibility to override threshold values of this monitor, the only solution was to rewrite the data source module type and the monitor type. In this example, we will see how to add a warning and critical overridable parameters.

So first, you’ll need to write your own data source module type. In this case, the easiest way to handle that is to copy/paste source code of the original data source and add parameters that you want to override. As you can see below, I added my two parameters (Warning Threshold, Critical Threshold) to the configuration schema and overridable parameters blocks.

Then, you need to create your monitor type that will use this data source module type. As this monitor type is also based on an existing monitor type, just copy/paste source code. And as for the data source module type, you will need to add your parameters to the configuration schema and overridable parameters blocks.

Then, you’ll need to call the data source module type that we created and build your conditions detection depending your needs. In this case, it is a three state monitor based on a script, so you need to create 3 condition detection based on your parameters. For this monitor type, the configuration of conditions is:

  • Healthy, when the value of the property named Value in the script will be greater than the value of the Warning Threshold parameter.
  • Warning, when the value of the property named Value in the script will be less or equal than the value of the Warning Threshold parameter AND when the value of the property named Value in the script will greater than the value of the Critical Threshold parameter.
  • Critical, when the value of the property named Value in the script will be less or equal than the value of the Critical Threshold parameter.

You can see a part of the configuration in the picture below. Just for information, you can also define these expressions directly in the monitor rather than in the monitor type. It depends on your needs.

Finally, you can create your monitor based on your previously created monitor type id and define your overridable parameters.

You can then verify in SCOM that you can override your parameters directly from the console.

You can retrieve MP source code of this example here. Enjoy.

Leave a Reply

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