shinken-monitoring / pack-linux-snmp

Configuration pack for Linux hosts
4 stars 16 forks source link

check_snmp_mem: Argument isn't numeric on RedHat variants #9

Open abaldoni opened 10 years ago

abaldoni commented 10 years ago

On Linux systems using a RedHat variant with net-snmp as the default snmpd provider with UCD MIBS, the check_snmp_mem.pl command reports the following errors: Argument "95923184 kB" isn't numeric in numeric eq (==) at ./check_snmp_mem.pl line 118.

I suggest changing the regexp in do_snmp from if ($x =~ /([a-zA-Z0-9]+): (.*)$/) { to if ($x =~ /([a-zA-Z0-9]+): ([0-9]+)[ ]?(kB)?$/) {

dooblem commented 9 years ago

Same on Ubuntu ! @abaldoni patch works like a charm. It also fixes perfdata for pnp4nagios.

Please fix it...

Before:

# /var/lib/shinken/libexec/check_snmp_mem.pl.orig -w 80 -c 95 -- -v 2c -c public XXXX
Argument "1019080 kB" isn't numeric in numeric eq (==) at /var/lib/shinken/libexec/check_snmp_mem.pl.orig line 118.
Argument "84928 kB" isn't numeric in subtraction (-) at /var/lib/shinken/libexec/check_snmp_mem.pl.orig line 127.
Argument "457200 kB" isn't numeric in subtraction (-) at /var/lib/shinken/libexec/check_snmp_mem.pl.orig line 129.
Argument "186880 kB" isn't numeric in subtraction (-) at /var/lib/shinken/libexec/check_snmp_mem.pl.orig line 129.
MEMORY OK: 28.46 % used; Free => 84928 kB Kb, Total => 1019080 kB Kb, Cached => 186880 kB Kb, Buffered => 457200 kB Kb|ram_free=84928 kB ram_total=1019080 kB ram_cached=186880 kB ram_buffered=457200 kB

After:

# /var/lib/shinken/libexec/check_snmp_mem.pl -w 80 -c 95 -- -v 2c -c public XXXX
MEMORY OK: 28.42 % used; Free => 87216 Kb, Total => 1019080 Kb, Cached => 185756 Kb, Buffered => 456480 Kb|ram_free=87216 ram_total=1019080 ram_cached=185756 ram_buffered=456480
Olivier4murs commented 7 years ago

Same for me with Shinken. Please merge this fix !