From 60ddcb909f7a599ad52c07ea6e74dde8fcf609fa Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 24 Jan 2013 00:04:38 +0100 Subject: check_mem: better output The output has now descriptions and the values are in MB. The perfdata stay in bytes. --- check_mem | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/check_mem b/check_mem index 8d83bc3..d3c0722 100755 --- a/check_mem +++ b/check_mem @@ -118,7 +118,14 @@ unless ($context) { my @mem = get_mem($n, $context); if (@mem) { my %values; + my %desc; ($values{'VM'}, $values{'RSS'}, $values{'ANON'}, $values{'VML'}) = @mem; + %desc = ( + VM => 'virtual memory', + RSS => 'resident set size', + ANON => 'anonymous memory', + VML => 'locked memory', + ); my @status = [ UNKNOWN ]; my $output = ""; @@ -138,10 +145,11 @@ if (@mem) { ) ); - $output .= " $values{$mem}"; + $values{$mem} = int(($values{$mem} / 1024) / 1024); + $output .= " - $desc{$mem}: $values{$mem}MB"; } - $n->nagios_exit($n->max_state(@status), "memory statistics:$output"); + $n->nagios_exit($n->max_state(@status), "used memory$output"); } $n->nagios_exit(UNKNOWN, 'unable to parse memory statistics'); -- cgit v1.2.3-1-g7c22