]> git.etc.gen.nz Git - spong.git/commitdiff
Fixed a bug in check_memory_top where $message would not get initialized, and
authorMichael Brown <michaelb@opentext.com>
Mon, 7 Jan 2002 21:25:24 +0000 (21:25 +0000)
committerMichael Brown <michaelb@opentext.com>
Mon, 7 Jan 2002 21:25:24 +0000 (21:25 +0000)
so get bigger and bigger and bigger...

src/lib/Spong/Client/plugins/check_memory

index 45d05a1bbe30d41438a6e710dbc91d647370bdb0..00e28d014661476e2504c36a20bff6c2ba8778e0 100755 (executable)
@@ -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 (<CMD>) {
       /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);