I was asked recently how to implement a notification subscription for service owners of distributed applications. Here’s a little tutorial on how I did it.
For this example I created a very simple distributed application, just to illustrate the solution.
Override for the Distributed Application
In order to get a notification we need to create an alert whenever the distributed application changes it state from healthy to non-healthy. Notification subscriptions are based on alerts.So in order to get notifications we need alerts first. By default, distributed applications itself do not raise an alert when the state changes but it is very simple to enable alerting:
Go to the Monitoring space and select the node “Distributed Applications” in the state view. Select the distributed application you want to enable alerting and open the health explorer:
Once the health explorer is loaded, DO NOT select the top level node (Entity Health), expand the Availability node and select the “All Contained Objects” node of your distributed application and create an override:
If you override the top level node, you will get an alert for each component group. I’m not sure if this behavior is by design or not but it’s clearly not what we want here. The catch is, that if you want to get notified for Performance, Configuration or Security issues as well, you need to repeat the steps above for each section.
In the Override Properties dialog, setup alerting:
To enable alerting you need to setup the following:
- Override “Generate Alert” with the value “True”.
- Override “Alert On State” with “The monitor is in a critical or warning state”. You might want to change this if you only want to be notified for critical states.
- Override “Auto-Resolve Alert” with the value “True”. This way you can also send out notifications when the distributed application recovered and is healthy again.
- Override “Alert Priority” with the value “Low”. This depends on your requirements. I chose Low because I want to keep down the noise. Usually you get alerts from each component, so it makes sense to keep it on Low.
- Override “Alert severity” with the value “Information”. Again this serves noise reduction and you could change it to any other value or matching the monitor value if you want or need to.
Click on OK to apply the override and close the properties dialog.
Ensure that the Alert is raised
As you can see, as soon as a component turns red, you get an informational alert for your distributed application:
Create a Subscription
Now we only need to create a notification subscription. Go to the Administration space and select Notifications/Subscriptions. Create a new subscription:
It is important that you choose the “All Contained Objects” role up monitor AND the instance of your distributed application (in my example “Test Application”).
If you want to react on multiple distributed applications in one subscription, you can create a group and put all distributed applications you want to notify on in this group. To do so, change to the “Authoring“ space and select Groups. Create a new group and add instances of “Distributed Applications” in the group using explicit members or with dynamic members if you want to follow a naming scheme. For this example I’m using explicit members:
Then change the subscription to include instances from a specific group:
After setting up the subscription, your recipients (the app owners) can now get emails whenever a component degrades an application.
Co-Founder and CEO of Royal Apps GmbH and Windows lead developer at http://www.royalapps.com where most of the time is spent on Royal TS, a multi platform, multi protocol remote management solution, for Windows, macOS and mobile supporting RDP, VNC, SSH, Telnet, and many more.
Long time Microsoft MVP (2010-2020) supporting communities on- and offline as well as speaking at user groups and conferences about DevOps and other software development topics.