The organization where I work provides a management & monitoring service for a number of different online properties managed within Microsoft. We leverage a shared System Center 2012 Operations Manager component platform infrastructure which reduces our operational costs – just one global platform to update, manage, and support.

One of the challenges though of running a shared OpsMgr platform is that we have to restrict access to the monitoring platform and our customers do not have “authoring access”. As all workflows (monitors/rules) are implemented through management packs, there isn't an easy way to allow our customers / partners to create their own (custom) monitors/rules and/or overrides. Most partners told us they wanted a way to create custom threshold monitors for disk-free space (in addition to the general out of the box ones) and they also wanted this to be done in a self-service manner.  Here’s how we’ve enabled this monitoring, which again, comes on top of the disk monitoring provided by OpsMgr out of the box not instead of it.

First - we've created a custom class let’s call it “SCMS LogicalDisk” with two properties - drive letter & minimum desired free space in Megabytes.

Second - we’ve created a script based discovered for this class that looks for values let’s say under “HKLM/system/SCOMmonitoring/customdiskmonitors” registry key.  The name of the values represents the logical disk letter and the value of the value represents the minimum % desired free space (that is a value of 30 represents that at the monitor will alert at less than 30% free space).

As a result - for each server we will discover a number of instances of the “SCMS LogicalDisk” class type equal with the number of values under the “HKLM/system/SCOMmonitoring/customdiskmonitors” registry key.

Our internal online property customers have admin access to their own servers so they can easily create the keys, and any number of them. 

Third - we've created a timed script two state monitor “SCMS LogicalDisk Free Space Monitor” that targets the custom logical disk class (“SCMS LogicalDisk”). The monitor runs every 5 minutes and checks the free disk space for the disk that relates to the drive letter (specified in one of the properties of the class) and compares it with the desired % free space attribute value (specified in one of the properties of the class). Should the % free disk space on the logical drive be less than the desired % free disk space the monitor goes in a critical state and alerts. When the % free space changes above the desired threshold the monitor goes back to a “healthy” state.

There are two key benefits to this approach:

- Enables our customers to create custom disk space monitors in a self-service manner (so it also reduces the management time required from the platform team) and

- Creates a more elegant solution than implementing the thresholds through overrides.

This approach can be extended beyond just disk space. Similarly, one could create custom monitoring for windows services by creating a class with two attributes - one being the Windows Service name and the other the Windows Service Desired state.  This could be very useful in custom fail-over scenarios were windows services are involved.

In fact the management pack contains the “SCMS Windows Service” class, the discovery and the monitor for this type of self-service monitoring. For discovery, the key used for windows services is HLKM/SYSTEM/SCOM/WindowsServiceMonitors and classes will be discovered based on string values under this key where the string name is the service name (NOT the display name) and the value represents the desired state (“RUNNING” or “STOPPED”). The monitor will compare the actual service state with the desired state and alert there is a mismatch.

For health rollup - we have created a custom aggregate monitor that rolls –up health to windows computer (“SCMS Custom Monitors”) and dependency monitors that roll-up health from our custom disk and windows services monitors to this custom one. If health rollup is not desired those monitors can be safely removed.

Please feel free to download the MP and customize it for your needs.  This file is attached without warranties/etc. - modify for your own use.