summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-01-24 00:04:38 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-24 00:04:38 +0100
commit60ddcb909f7a599ad52c07ea6e74dde8fcf609fa (patch)
tree047f6e6f66907c720d0e30d922b7c936d95b21cf
parent97f21c91592733e00c17703f71632024c3fd9019 (diff)
downloadvserver-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-xcheck_mem12
1 files 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');