If you ever wanted to monitor Windows services, but only during business hours, then this is the post for you.  I have put together an example MP that contains a new monitor type that includes a Schedule Filter so you can specify when the monitor should or shouldn’t run.  The new monitor type is fundamentally the same as the monitor type for service monitoring that is included in the Microsoft.Windows.Library MP, but now has System.SchedulerFilter included.

Here is a breakdown of the modules used within the monitor type:

  1. Microsoft.Windows.Win32ServiceInformationProvider – This data source returns the state of a service.
  2. System.SchedulerFilter – A condition detection where it is possible to specify the times in which the data should or should not be processed.
  3. System.ExpressionFilter – This module is used twice, one to filter a service running condition, and one to filter a service not running condition.

After the member modules are configured, the composition of the monitor type can be put together for the OK state (service running) and the BAD state (service not running).

image

 

I have also included a monitor in the management pack that uses this new monitor type.  The configuration of the monitor is just the same as the configuration of the standard service monitors, but with the added parameters of Start, End and DaysOfWeekMask.

image

The Start parameter allows you to specify at what time monitoring should start, and the End parameter allows you specify when the monitoring should end.  The DaysOfWeekMask is a number that controls which days the monitor will run.  For a list of all the possible values for the DaysOfWeekMask, use this TechNet article, http://technet.microsoft.com/en-us/library/ee808920.aspx.

So that’s it, you can take my example MP and edit it to achieve the monitoring you are after.  You can also open up the MP in one of the authoring tools and change as required; as I mentioned above, the scheduler filter can be used not only to specify when data can be processed, but it may also be used to control when data should not be processed, and you can span multiple days if required.

Have fun!

David