SCOM Powershell Monitor generated alerts for a lower threshol

ANU 336 Reputation points

Hi All, Thanks in advance.

We are using powershell MP.

I created a custom Monitor with powershell MP. The alert is always getting generated with a lower value

Created Event login for the property bag output. The value is successfully getting captured.
the output will always an Integer

The condition to generate an alert is if the value is greater than 100.

The current property bag value is 6. Unfortunately its generating alert on the value 6.

Troubleshooting step performed:

1) Exported the MP containing custom monitor
2) navigate the xml file and fine "XPathQuery Type" and "Value Type"
By defaul, it is string data type, you should modify it into suitable data type
3) possible data types

Tried with string and integer types but bad luck unfortunately still alert is generating with a lower value.
Any help will be thankful.

Thanks & regards,

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,446 questions
0 comments No comments
{count} votes

Accepted answer
  1. CyrAz 5,181 Reputation points

    You can add a type at the first xpathquery directly in XML, that won't be a problem and that's very likely the cause of your issue.
    That can actually be demonstrated easily with PowerShell :
    $counts = "6"


    $counts -gt 100


    $counts -gt 70


    $intCounts = 6 #not using quotes here


    $intCounts -gt 100


    That shows that when running a comparison between a string and an integer, only the first number of the integer is taken into account.
    But when the comparison is made between two integers it works properly.

    Also I don't understand why you made the expression like this... It states that the value must be greater than 100 and not equal to -3 and not equal to -2 and not equal to -1 : that doesn't make a lot of sense, anything greater than 100 can mathematically never have a value below 0 so there is no point specifiyng all this...

4 additional answers

Sort by: Most helpful
  1. CyrAz 5,181 Reputation points

    Could you show us the relevant xml code?

    0 comments No comments

  2. SChalakov 10,371 Reputation points MVP

    Hi @ANU ,

    can you please paste the script here so that we can take a look?


    0 comments No comments

  3. ANU 336 Reputation points

    @CyrAz @SChalakov unfortunately i am not able to copy paste the code over here. I can attach as a screenshot for the criteria.



    0 comments No comments

  4. CyrAz 5,181 Reputation points

    Xpathquery has no type in the first expression and is typed as string in the following two expressions.
    It should work if you type it as integer.