Using Integers and other “non-string” data types in Rules and Monitors
Published Mar 12 2019 04:50 PM 689 Views

First published on TECHNET on Oct 01, 2009

If you need to use any non-string data type in the criteria for custom Rules and Monitors, you’ll need to edit the XML in order for it to work properly.  By default, OpsMgr will treat everything as a String value and the Rule/Monitor will not work properly.


For example, I created a rule to watch for Event ID 1000 in the Application Log and throw an Alert if Parameter 1 is greater than 20.  Here is the Rule criteria:



Using Event Log Explorer (awesome tool for testing, get it here ), I generate Event 1000 with Parameter 1 set to 9:




I then received the following alert:


The reason I received this alert is that if OpsMgr is evaluating Parameter 1 as a String Value, then 9 would be greater than 20 (since 9 is greater than 2).

To correct, this I’ll need to edit the XML of the rule to change the data type to Integer.

So, I export the Management Pack that contains this Rule and look at the XML.


Here is the full XML of the Rule.  The expression that we are concerned with is highlighted in green , and the part we need to change is in red .


<Rule ID="MomUIGeneratedRuleb80bc5a17ec4486185215843882c0046" Enabled="true" Target="MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
<DataSource ID="DS" TypeID="MicrosoftWindowsLibrary6062780!Microsoft.Windows.EventProvider">
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
<Value Type="UnsignedInteger">1000</Value>
<XPathQuery Type="String">Params/Param[1]</XPathQuery>
<Value Type="String">20</Value>

<WriteAction ID="Alert" TypeID="Health!System.Health.GenerateAlert">
<AlertOwner />
<Suppression />
<Custom1 />
<Custom2 />
<Custom3 />
<Custom4 />
<Custom5 />
<Custom6 />
<Custom7 />
<Custom8 />
<Custom9 />
<Custom10 />


To get this rule to work as expected, we’ll need to change “String” to “Integer”

<XPathQuery Type="Integer">Params/Param[1]</XPathQuery>
<Value Type="Integer">20</Value>


So, I make the change to the XML, update the version number of the MP, and reimport it.

I create the same event on the agent an no longer get alerted on it.

The possible data types that can be used here are:


Version history
Last update:
‎Feb 20 2020 10:38 AM
Updated by: