[Xymon] Powershell ext script working with alarm colors

Brandon Dale BDale at kitchengroup.com.au
Wed Apr 27 05:59:58 CEST 2016


You can only send one colour per column back to xymon so you need to have logic to determine the "overall" colour if you are testing multiple things or split it into separate columns. The way I have done this in the past is just have the message that is displayed on the column show something like the below so I can identify exactly what has failed:

TEST 1 = OK
TEST 2 = OK
TEST 3 = NOT OK

And in the script when anything triggers yellow/red threshold I just add to a count and then at the end I use that to determine the colour with red always "winning" if anything triggers red. Something like:

If($RedCount -gt 0)
{
                $colour = 'red'
}
Elseif($YellowCount -gt 0)
{
                $colour = 'yellow'
}
Else
{
                $colour = 'green'
}


The other option is you can just put your whole thing into the same if statement but that may not be what you want.


if($TIME_Exceeded) {
    $STATUS = "yellow"
    $STATUSCODE = "&yellow This is taking longer than usual"
}
elseif($CurrentConnections -gt 16000)
{
    $STATUS = "red"
    $STATUSCODE = "&red Current Connections exceed 1600"
}
elseif($CurrentConnections -gt 15000)
{
    $STATUS = "yellow"
    $STATUSCODE = "&yellow Current Connections exceed 1500"
}


Regards,


Brandon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20160427/51052a51/attachment.html>


More information about the Xymon mailing list