I’m posting this by request from a customer who desires to setup an alert when a hosted service changes its state. The process is fairly straightforward, provided you know where to look. In the screenshot below, we have a hosted service (in my case, eponymously named walterm), that is currently healthy. What we want is to generate an alert if the health state of this service changes.

image

By default, there is already an “out of the box” monitor at the Windows Azure role level which you will find in the Monitors view of the Authoring pane. Navigate to Windows Azure Role | Entity Health | Availability, as seen below. There you will find the monitor titled Role Instance Availability Dependency. Right-click on this item and select the Properties page.

image

On the Properties page, choose the Alerting tab, where you can verify that by default the alerts are being generated for this monitor, as seen below.

image

Now if you want to create an individual monitor at the role instance level (whether for all role instances or for individual hosted services) then you can override the out of the box monitor already at that level, which doesn’t generate alerts by default. For our example, we will navigate to the general Windows Azure Role Instance for a specific hosted service, as seen below.

image

Right-click on the Windows Azure Role Instance Status Monitor item and select the Properties page. If you don’t see it, scroll down to the Generates Alert parameter name, as seen below. Change the Override Value to “True.”

image

Next, if you don’t see the Enforced column, scroll horizontally until you see it and select Enforced for this monitor, as seen below. When you’re done, select the Apply button, and then select the OK button.

image

Let’s now right-click on the monitor you just modified, and from the flyout menu select Overrides | Override the Monitor | For all objects of class: Windows Azure Role Instance (your_hosted_service_name).

image

You will now see the override you just created, as seen below. Go ahead and select the Close button.

image

We will now go to the Windows Azure management portal and stop the service we desire to test, as seen below.

image

When we return to the SCOM console and select the Hosted Service State node for our management pack, after a few minutes the service state will change to critical, as seen below.

image

Shortly after the state change, alerts will show up in the Active Alerts view, as seen below.

image

If we now select an alert with the name Windows Azure role is not running, we can see that this alert was generated at the level of Windows Azure role, as seen below.

image

If our role instance level override was setup properly, we should also see a similar alert with the name Microsoft.SystemCenter.Azure.RoleInstance.Status.Monitor. This is the alert we previously (and successfully) configured, as seen below.

image