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

SourceForge.net <[email protected]>
Newsgroups gmane.network.nagios.plugins.devel
Message-ID <[email protected]>
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@machine ~]# /usr/lib64/nagios/plugins/contrib/check_mem.pl -f -w 40 -c 20
Memory CRITICAL - 16.9% (74588 kB) free
[root@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

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________________
Nagios Plugin Development Mailing List Nagiosplug-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
::: Please include plugins version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.