OpsMgr: Sample Alert Widget Template with Logical Expression Filtering Capabilities
This article features a sample management pack that includes a widget template that allows the user to create custom alert widgets via a UI and filter the alerts to be displayed on the widget using very simple logical expressions for a scoped object or group.
This sample management pack library can now be downloaded from the TechNet Gallery.
Here’s the back story on why and how this custom alert widget template came to be:
The filtering options available on the Criteria page of the OOTB alert and contextual alert widget templates are very limited. As shown in the picture below, there are only 3 filtering options available: by Severity, Priority and Resolution State.
This limits the user’s ability to filter the alerts displayed on the OOTB alert widgets by other alert properties like CustomFields 1 – 10, IsMonitorAlert, etc.
Trying to modify the overly convoluted Criteria property string of Component Override of the custom alert widget created from the template UI to include additional alert properties for filtering did not work for me either.
Fortunately, I came across the Office 365 Monitoring Dashboard of the System Center Management Pack for Office 365, where I noticed that the alerts displayed on the alert widgets for the Active/Resolved Incidents are primarily filtered by Custom Fields. For example, the filtering criteria string used in the Active Incidents widget is: "CustomField2 = 'Active' AND ResolutionState != 255"
With this finding, I decided to put together a management pack library that includes a custom alert component that accepts a simple logical expression for its criteria string , and a template (Sample Enhanced Filter Alert Widget) to allow users to create instances of alert widgets based on this custom component with a UI in the Operations Console.
Importing the management pack will allow the widget template to appear under the "All Templates/WeiOutThere Alert Widget" folder in the "New Dashboard and Widget Wizard" page:
To create an instance of this custom alert widget, first create a dashboard layout (with n-cells), Click to add widget on a cell, then select the Sample Enhanced Filter Alert Widget template.
The “Expression” page allows the logical expression filtering string to be added as follows:
Here is a comparison between an alert widget created from the OOTB Alert Widget template, and an alert widget created from the Sample Enhanced Filter Alert Widget template with the criteria string: "CustomField2 = 'Active' AND ResolutionState != 255“ . Both widgets target the “All Windows Computers” group in this instance.
Adding the string “Active” to CustomField 2 of any alerts displayed on the left widget will satisfy the filtering criteria of the right widget and hence cause it to show up there.
Note that NOT ALL alert fields can be used in the logical expression of the filtering criteria. In cases where an invalid field is used, an error message will be displayed. Here’s an example:
Thank you for your support !