diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-24 00:04:38 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-24 00:04:38 +0100 |
commit | 60ddcb909f7a599ad52c07ea6e74dde8fcf609fa (patch) | |
tree | 047f6e6f66907c720d0e30d922b7c936d95b21cf | |
parent | 97f21c91592733e00c17703f71632024c3fd9019 (diff) | |
download | vserver-monitoring-60ddcb909f7a599ad52c07ea6e74dde8fcf609fa.tar.gz vserver-monitoring-60ddcb909f7a599ad52c07ea6e74dde8fcf609fa.tar.bz2 vserver-monitoring-60ddcb909f7a599ad52c07ea6e74dde8fcf609fa.zip |
check_mem: better output1.5
The output has now descriptions and the values are in MB. The
perfdata stay in bytes.
-rwxr-xr-x | check_mem | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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'); |