From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/76452-check_mem.diff | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 web/attachments/76452-check_mem.diff (limited to 'web/attachments/76452-check_mem.diff') diff --git a/web/attachments/76452-check_mem.diff b/web/attachments/76452-check_mem.diff new file mode 100644 index 0000000..01d0d97 --- /dev/null +++ b/web/attachments/76452-check_mem.diff @@ -0,0 +1,36 @@ +--- check_mem.pl 2002-02-28 00:42:54.000000000 -0600 ++++ /home/jason/check_mem.pl 2004-02-12 06:20:21.000000000 -0600 +@@ -27,7 +27,8 @@ + $crit_level $warn_level + %exit_codes @memlist + $percent $fmt_pct +- $verb_err $command_line); ++ $verb_err $command_line ++ $vmstat_version); + + # Predefined exit codes for Nagios + %exit_codes = ('UNKNOWN' ,-1, +@@ -39,7 +40,14 @@ + $verb_err = 0; + + # This the unix command string that brings Perl the data +-$command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`; ++my $vmstat_version = `vmstat -V`; ++if( $vmstat_version =~ /2\.\d\.\d$/ ){ ++ $command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`; ++}elsif( $vmstat_version =~ /3\.\d\.\d$/ ){ ++ $command_line = `vmstat | tail -1 | awk '{print \$3,\$4}'`; ++}else{ ++ $command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`; ++} + + chomp $command_line; + @memlist = split(/ /, $command_line); +@@ -89,6 +97,7 @@ + if ($opt_f) + { + $percent = $free_memory / $total_memory * 100; ++ warn "$percent\n"; + $fmt_pct = sprintf "%.1f", $percent; + if ($percent <= $crit_level) + { -- cgit v1.2.3-74-g34f1