Problem with (someone else's) Perl code...
Posted on 2005-04-20
I am using a monitoring package called BigBrother (written in C I think). Anyway, one of the Open Source add-ons is written in Perl. Basically this perl script uses Net::SNMP to get some stats from Cisco devices, check the results, and return a status to the BigBrother server. Forgetting the BigBrother part, all this script does is check the SNMP values, and execute a command that reports the status.
Status for BigBrother is based on color...
Red = Bad
Yellow = Warning
Green = OK
Clear = No results
As an example, this script will check the fans on a Cisco Router. If all the fans return OK, then the result is green. Another example, it will check the power supplies. If all the power supplies are OK, it returns green.
Here's the problem. The code checks each power supply, then looks for the "worst color". So if one power supply is bad, and three more are green, the overall alert should be red.
Something is wrong with this routine. It's returning green, even when one power supply is red.
This is someone else's code, and I tried to get in touch with them, but have gotten no answers. Could anyone take a look at the code and see if you can find a problem. I'll post the code below...