[Nagiosplug-devel] [ nagiosplug-Bugs-3600414 ] check_mem.pl incorrectly reads parameters from vmstat

SourceForge.net noreply at sourceforge.net
Fri Jan 11 17:35:14 CET 2013


Bugs item #3600414, was opened at 2013-01-11 08:35
Message generated for change (Tracker Item Submitted) made by lehtinen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3600414&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General plugin execution
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Lassi Lehtinen (lehtinen)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_mem.pl incorrectly reads parameters from vmstat

Initial Comment:
Seems like the check_mem.pl script incorrectly reads the parameters from vmstat on Linux-host:

[root at machine ~]# /usr/lib64/nagios/plugins/contrib/check_mem.pl -f -w 40 -c 20
Memory CRITICAL - 16.9% (74588 kB) free
[root at machine ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
  1  0      0 366640  74604 9415164    0    0  5856  3863    1    5  0  2 98  0  0

Problems seems to be here:

<clip>
# This the unix command string that brings Perl the data
$command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`;

chomp $command_line;
@memlist      = split(/ /, $command_line);

# Define the calculating scalars
$used_memory  = $memlist[0];
$free_memory  = $memlist[1];

$total_memory = $used_memory + $free_memory;
</clip>

Executing $command_line first prints amount of free-memory and then amount of buffered-memory, but these
are put to variables so that $used_memory has the amount of free  memory, and $free_memory the amount of
buffered memory. So the script actually reports inveresly free/used memory.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3600414&group_id=29880




More information about the Devel mailing list