-# $Id: check_memory,v 1.2 2001/06/21 15:42:12 supermathie Exp $
+# $Id: check_memory,v 1.3 2002/01/07 21:25:24 supermathie Exp $
# vim:syn=perl:expandtab:ts=3:sw=3:ai:si
# Register this routine with the plugin registry
$CHECKFUNCS{'memory'} = \&check_memory;
sub check_memory_top {
$kmb='\s+(\d+[KM])';
- @parse_error = ("yellow", "Can't parse memory line", $message);
+ $message = "";
open CMD, "$MEMCHECK |";
while (<CMD>) {
/PID/ && last;
&to_KB($swaptotal, $swapused, $swapfree, $cached);
} else {
close CMD;
- return @parse_error;
+ return ("yellow", "Can't parse memory line", $message);
};
$hardmemused = $memused-$buffers-$cached;
} elsif (/^Memory:$kmb real,$kmb free,$kmb swap,$kmb free swap/) {
$swaptotal = $swapused+$swapfree;
} else {
close CMD;
- return @parse_error;
+ return ("yellow", "Can't parse memory line", $message);
}
$physpctused = floor($hardmemused/$memtotal*100);
$virtpctused = floor(($hardmemused+$swapused)/($memtotal+$swaptotal)*100);