How to schedule a web site monitor during Business hours


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”>
        <Configuration />
        <ModuleImplementation Isolation=”Any”>
          <Composite>
            <MemberModules>
              <DataSource ID=”Scheduler” TypeID=”System!System.Scheduler”>
                <Scheduler>
                  <SimpleReccuringSchedule>
                    <Interval>300</Interval>
                  </SimpleReccuringSchedule>
                  <ExcludeDates />
                </Scheduler>

These data source are the basis for all the monitors implemented in the MP, the composition is like this:

<Composition>
  <Node ID=”Probe”>
         <Node ID=”Scheduler” />
  </Node>
</Composition>

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”>
    <SchedulerFilter>
      <ProcessDataMode>OnSchedule</ProcessDataMode>
      <Schedule>
        <WeeklySchedule>
          <Windows>
            <Daily>
              <Start>07:00</Start>
              <End>19:00</End>
              <DaysOfWeekMask>62</DaysOfWeekMask>
            </Daily>
          </Windows>
        </WeeklySchedule>
        <ExcludeDates />
      </Schedule>
      <UseCurrentTime>true</UseCurrentTime>
    </SchedulerFilter>
  </ConditionDetection>
</MemberModules>
<Composition>
  <Node ID=”Probe”>
    <Node ID=”Filter”>
      <Node ID=”Scheduler” />
    </Node>
  </Node>
</Composition>

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)

Advertisements
  1. #1 by Larry Leblanc on January 7, 2010 - 3:59 pm

    Good day Daniele,

    I really appreciated this blog, as it answers exactly the problem we encountered, and the other posts regarding a monitor didn’t quite drive it home in the case of a web app.

    I do have 2 questions however:
    Q1: Is there a way of specifying more than window, for example, 08h00-17h00 Mon&Tue, 09h00-13h00 Wed, 10h00-14h00 Thu&Fri?
    Q2: How does one go about coding an outage window, such as 7×24 monitoring, with the exception of 00h00-02h00 Mon&Tue? Note that this might be answered along with Q1.

    Thanks,

    Larry

  2. #3 by Daniele Grandini on February 5, 2009 - 2:30 pm

    Hi Nick,
    Yes It can be done but not via UI, overall the process is similar to the one illustrated for a Windows Service (see the post). I’ll try to blog on the missing event in the next few weeks.

  3. #4 by Nick M on February 4, 2009 - 9:48 am

    Really interested in how to do this for a missing event monitor – i need to alert for two missing events in two hours, only inside business hours, and can’t do it via the UI.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: