One of the most common requirements that I received from different customers is to provide more details in the alerts being raised from a monitor.
After reviewing different possible approaches I came up with a solution that provide the desired functionality and flexibility that I will present here.
The sample code described here contains specific implementation, but it could easily being adjusted for other types, that consider a web application monitors to check for different results, like returned status code, reachable status, Error code and content match criteria. All these standards monitor types usually used for web application monitoring.
The module being used is “Microsoft.SystemCenter.WebApplication.UrlProbe” defined inside the Web Application library that SCOM provide.
Usually when we define this type of monitors, the returned data type is a Web Application data, that provide multiple details of a web requests collection, and the usual alert context will present all the valuable information inside the context presented by the alert, but not in the alert itself.
Consider that many customers, configured notification channels like emails, to received alerts during weekends, or nights, where the initial information provide key details to take actions. So all the details that can be added in the notification will help take the proper actions, without connecting to the SCOM environment and opening the console to review the details.
So, here is a solution for that scenario:
We will require to add another condition detection that will be at the end of the implementation chain calls. This module will “format” all the desire info in a new data time, “Event Data type”, which provide extended way to include different parameters that can be assigned from configuration values, target values, returned values, etc. As long as the value is available inside the monitor is possible to include all the desire information.
Once you got this setup. is easy to present the info, as part of the alert parameters being passed to the alert, and all the info will be presented in the alert context.
Note that we don’t need to pass all the parameters collection, just the alert description, which already contain all the key information that will be included.
The output obtained here is something like this:
As you can see here, we got not only the different tests executed, their configurations, also the returned values.
The sample code is available here: