Following my previous post on how to schedule a monitor during business hours only, I’ve been asked how to achieve the same result with a web site monitor and a service monitor. Here we can have two approaches: first create the monitor via the authoring space in console or create from scratch a brand new MP. I suspect the first method is the easiest for most of us, so I will try to explain this one. In a second post I will do the same for service monitoring, but this time we’ll see this is going to be a little more difficult.
So let’s start with our Add Monitoring Wizard and select the Web Application template, please remember to create a new MP. We can then complete the wizard and add any custom steps we think it’s appropriate. Once the monitoring is ready we simply need to export the relative MP. The wizard ahs created for us one or more DataSourceModuleType entries like the following one:
<DataSourceModuleType ID=”WebApplication_5cdfdc9c54904bec93bb75fb13d32cc3.UrlDataSource” Accessibility=”Public” Batching=”false”>
<DataSource ID=”Scheduler” TypeID=”System!System.Scheduler”>
These data source are the basis for all the monitors implemented in the MP, the composition is like this:
<Node ID=”Scheduler” />
This should sound familiar by now if you read my previous post on this topic. What we need to do is just add a System.SchedulerFilter and inject it into the module composition:
<ConditionDetection ID=”Filter” TypeID=”System!System.SchedulerFilter”>
<Node ID=”Scheduler” />
Obviously this approach has some shortcuts:
1) the business hour period is not configurable via overrides but instead cabled into the MP. To do this we should modify the coniguration of the DataSource and of all the unit monitors that are using this DataSource.
2) if we have several URL to monitor this needs to be repeated for every data source
Remember, we can always leave the monitor run all day long and then suppress the alerts generated during the non BH period via a powershell script, use a scheduled subscription to avoid receiving notifications during the night shift and use the BH filter in availability reports. So running monitors during BH is nice, but if it takes more work than it’s worth then we can implement these alternative strategies.
I attach a complete MP that monitors nocentdocent.wordpress.com. (http://cid-558ec647eef17f8d.skydrive.live.com/self.aspx/.Public/Sample%20MPs/Progel.Web.BH.xml)