[Nagiosplug-devel] patch: contrib/check_mem.pl using incorrectcommand

Cook, Garry GWCOOK at mactec.com
Wed Aug 18 11:20:02 CEST 2004


nagiosplug-devel-admin at lists.sourceforge.net wrote:
> On Wed, 18 Aug 2004, C. Bensend wrote:
>>> Almost certainly. Anyone got any other platforms to hand who could
>>> let me know the format (if any) of their "free" and "vmstat"
>>> commands? 
>> 
>> OpenBSD 3.5-STABLE vmstat:
> 
> Based on that, I looked for other machines. A few hours of
> fiddling with
> the Sourceforge compile farm and the HP Testdrive later, I think the
> script should now be there. 
> 
> For linux, cygwin and solaris/sunos, it will report the
> free/used physical
> memory. With the -s switch, it will report swap useage
> 
> For FreeBSD, NetBSD, OpenBSD, HP-UX and some dec thing, it
> reports overall
> (physical + swap combined) useage, and will barf if asked about swap.
> 
> I can also confirm that all the system's I've seen report meaningful
> numbers in columns 4 and 5 of vmstat. It's just a pity they
> can't agree on
> what the hell they actually are, or mean....
> 
> Do people want to try the attached version?
> 
> Nick

I've attached a patch which adds Performance Data output, and also adds
the 's' flag to the usage output.
However, as you can see from what I've pasted below, only 'used' works
on my RH9 system. Free and Swap are borked.

/usr/local/nagios/libexec: perl check_mem.pl -u -w 20 -c 25

Memory CRITICAL - 25.5% (262688 kB) used, 1030344 kB total | 'Memory
Used'=25.5%;20;25;0;100
/usr/local/nagios/libexec: perl check_mem.pl -u -w 20 -c 35
Memory WARNING - 29.9% (308424 kB) used, 1030344 kB total | 'Memory
Used'=29.9%;20;35;0;100
/usr/local/nagios/libexec: perl check_mem.pl -u -w 60 -c 80  
Memory OK - 26.9% (277600 kB) used, 1030344 kB total | 'Memory
Used'=26.9%;60;80;0;100
/usr/local/nagios/libexec: perl check_mem.pl -f -w 60 -c 80 

check_mem.pl v1.0 - Nagios Plugin

usage:
 check_mem.pl -<f|u|s> -w <warnlevel> -c <critlevel>

options:
 -f           Check FREE memory
 -u           Check USED memory
 -s           Check swap instead of regular memory. Only on some systems
 -w PERCENT   Percent free/used when to warn
 -c PERCENT   Percent free/used when critical

Copyright 2000 Dan Larsson <dl at tyfon.net>, 2004 Nick Burch
<nick at torchbox.com>
check_mem.pl comes with absolutely NO WARRANTY either implied or
explicit
This program is licensed under the terms of the
GNU General Public License (check source code for details)
/usr/local/nagios/libexec: perl check_mem.pl -s -w 60 -c 80 

check_mem.pl v1.0 - Nagios Plugin

usage:
 check_mem.pl -<f|u|s> -w <warnlevel> -c <critlevel>

options:
 -f           Check FREE memory
 -u           Check USED memory
 -s           Check swap instead of regular memory. Only on some systems
 -w PERCENT   Percent free/used when to warn
 -c PERCENT   Percent free/used when critical

Copyright 2000 Dan Larsson <dl at tyfon.net>, 2004 Nick Burch
<nick at torchbox.com>
check_mem.pl comes with absolutely NO WARRANTY either implied or
explicit
This program is licensed under the terms of the
GNU General Public License (check source code for details)


And, just to be sure that it was not the changes that I've made which
broke the plugin:

/usr/local/nagios/libexec: perl check_mem.orig.pl -s -w 60 -c 80


check_mem.pl v1.0 - Nagios Plugin

usage:
 check_mem.pl -<f|u> -w <warnlevel> -c <critlevel>

options:
 -f           Check FREE memory
 -u           Check USED memory
 -s           Check swap instead of regular memory. Only on some systems
 -w PERCENT   Percent free/used when to warn
 -c PERCENT   Percent free/used when critical

Copyright 2000 Dan Larsson <dl at tyfon.net>, 2004 Nick Burch
<nick at torchbox.com>
check_mem.pl comes with absolutely NO WARRANTY either implied or
explicit
This program is licensed under the terms of the
GNU General Public License (check source code for details)
/usr/local/nagios/libexec: perl check_mem.orig.pl -f -w 60 -c 80   

check_mem.pl v1.0 - Nagios Plugin

usage:
 check_mem.pl -<f|u> -w <warnlevel> -c <critlevel>

options:
 -f           Check FREE memory
 -u           Check USED memory
 -s           Check swap instead of regular memory. Only on some systems
 -w PERCENT   Percent free/used when to warn
 -c PERCENT   Percent free/used when critical

Copyright 2000 Dan Larsson <dl at tyfon.net>, 2004 Nick Burch
<nick at torchbox.com>
check_mem.pl comes with absolutely NO WARRANTY either implied or
explicit
This program is licensed under the terms of the
GNU General Public License (check source code for details)


Garry W. Cook, CCNA
Network Infrastructure Manager
MACTEC, Inc. - http://www.mactec.com/
303.308.6228 (Office) - 720.220.1862 (Mobile)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_mem.pl.patch
Type: application/octet-stream
Size: 2513 bytes
Desc: check_mem.pl.patch
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20040818/8000e875/attachment.obj>


More information about the Devel mailing list