From: Michael Brown Date: Mon, 7 Jan 2002 21:25:24 +0000 (+0000) Subject: Fixed a bug in check_memory_top where $message would not get initialized, and X-Git-Tag: spong-2_7_7~28 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9e42caa7552889fcb036289613a180e8867cb9c;p=spong.git Fixed a bug in check_memory_top where $message would not get initialized, and so get bigger and bigger and bigger... --- diff --git a/src/lib/Spong/Client/plugins/check_memory b/src/lib/Spong/Client/plugins/check_memory index 45d05a1..00e28d0 100755 --- a/src/lib/Spong/Client/plugins/check_memory +++ b/src/lib/Spong/Client/plugins/check_memory @@ -1,4 +1,4 @@ -# $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; @@ -63,7 +63,7 @@ sub check_memory_free { sub check_memory_top { $kmb='\s+(\d+[KM])'; - @parse_error = ("yellow", "Can't parse memory line", $message); + $message = ""; open CMD, "$MEMCHECK |"; while () { /PID/ && last; @@ -81,7 +81,7 @@ sub check_memory_top { &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/) { @@ -98,7 +98,7 @@ sub check_memory_top { $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);