Bugs in apcsnmp.pl

Ed Eyles ed.eyles at rothamsted.ac.uk
Mon Feb 8 10:53:08 CET 2021


I am using Xymon 4.3.28.  I've had problems with the script 'server/etc/apcsnmp.pl' attempting to apply SNMP checks to systems where no such checks are defined.  For example, the following line in my hosts.cfg:

<IP address> xxx-test01.<domain> # NAME:xxx-test01

...results in the SNMP 'test' check being applied to system xxx-test01, even though no such check is asked for.  This appears to be owing to the way hosts.cfg is parsed by apcsnmp.pl: it looks for various strings, such as "test", appearing /anywhere/ within each line of hosts.cfg, not simply as keywords.  I have edited my copy of apcsnmp.pl such that it will look for each of these strings only where it is preceded by a space character or a tab character, and only where it ends at a word boundary.  (I did not want to use Perl's '\s' regex shorthand in the check for whitespace before the string, because this would also match newlines.)  This will prevent checks being applied because their names form part of a larger string.

A side-effect of making this change was that the 'volt' checks we had defined for our UPSs stopped working.  This was because these checks had been specified as "voltage" in our hosts.cfg.  Changing these checks to read "volt" cured this problem.  I do not know whether that use of "voltage" in hosts.cfg was a peculiarity of ours, or whether it came from some sort of predefined Xymon configuration.

I attach a copy of our revised apcsnmp.pl script, in case you would like to merge this in to your main branch.  I also attach a Zip version of it, in case your mail system will not allow Perl scripts as attachments.

Regards
Ed

Rothamsted Research is a company limited by guarantee, registered in England at Harpenden, Hertfordshire, AL5 2JQ under the registration number 2393175 and a not for profit charity number 802038.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20210208/49e1c218/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apcsnmp.pl
Type: application/octet-stream
Size: 42600 bytes
Desc: apcsnmp.pl
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20210208/49e1c218/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apcsnmp.pl.zip
Type: application/x-zip-compressed
Size: 8238 bytes
Desc: apcsnmp.pl.zip
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20210208/49e1c218/attachment.bin>


More information about the Xymon mailing list