[Orca-checkins] r374 - in trunk/orca/data_gatherers: aix hp

Blair Zajac blair at orcaware.com
Mon Jul 12 22:08:58 PDT 2004


Author: blair
Date: Mon Jul 12 22:02:34 2004
New Revision: 374

Modified:
   trunk/orca/data_gatherers/aix/orca-aix-stat.pl.in
   trunk/orca/data_gatherers/hp/orca-hp-stat.pl.in
Log:
Bug fixes from Frederic Viry <frederic.viry at francetelecom.com>.

* data_gatherers/aix/orca-aix-stat.pl.in:
  (main):
    The script calculates incorrect values for uptime and nusr.
    Do not sleep in the last iteration of the main loop, because the
      script will exit the script immediately anyway after the sleep.

* data_gatherers/hp/orca-hp-stat.pl.in:
  (main):
    Do not sleep in the last iteration of the main loop, because the
      script will exit the script immediately anyway after the sleep.


Modified: trunk/orca/data_gatherers/aix/orca-aix-stat.pl.in
==============================================================================
--- trunk/orca/data_gatherers/aix/orca-aix-stat.pl.in	(original)
+++ trunk/orca/data_gatherers/aix/orca-aix-stat.pl.in	Mon Jul 12 22:02:34 2004
@@ -175,12 +175,37 @@
     }
     @upt = split(/ +/,);
     $uptd = $upt[3];
-    $nusr = $upt[6];
     $up_day = $uptd * 24 * 60 * 60;
-    if (/days,\s+(\S+):(\S+), /) {
+    $up_hrs = 0;
+    $up_min = 0;
+
+    if (/day(?:s?),\s+(\S+)\s+min(?:s?),/) {
+      $nusr = $upt[7];
+      $up_min = $1 * 60;
+    } elsif (/day(?:s?),\s+(\S+)\s+hr(?:s?),/) {
+      $nusr = $upt[7];
+      $up_hrs = $1 * 60 * 60;
+    } elsif (/day(?:s?),\s+(\S+):(\S+), /) {
+      $nusr = $upt[6];
       $up_hrs = $1 * 60 * 60;
       $up_min = $2 * 60;
+    } elsif ($_ !~ /day/) {
+      $up_day = 0;
+      if (/\s+(\S+):(\S+),/) {
+        $nusr = $upt[4];
+        $up_hrs = $1 * 60 * 60;
+        $up_min = $2 * 60;
+      } elsif (/\s+(\S+)\s+min(?:s?),/) {
+        $nusr = $upt[5];
+        $up_min = $1 * 60;
+      } elsif (/\s+(\S+)\s+hr(?:s?),/) {
+        $nusr = $upt[5];
+        $up_hrs = $1 * 60 * 60;
+      }
+    } else {
+      $nusr = $upt[5];
     }
+
     $uptime = $up_day + $up_hrs + $up_min;
   }
   close IN;
@@ -587,7 +612,9 @@
   }
   print OUT $out_info, "\n";
 
-  sleep $INTERVAL - (time() - $timestamp);
+  if ($iterations) {
+    sleep($INTERVAL - (time() - $timestamp));
+  }
 }
 close OUT;
 

Modified: trunk/orca/data_gatherers/hp/orca-hp-stat.pl.in
==============================================================================
--- trunk/orca/data_gatherers/hp/orca-hp-stat.pl.in	(original)
+++ trunk/orca/data_gatherers/hp/orca-hp-stat.pl.in	Mon Jul 12 22:02:34 2004
@@ -410,7 +410,9 @@
   }
   print OUT $out_info, "\n";
 
-  sleep $INTERVAL - (time() - $timestamp);
+  if ($iterations) {
+    sleep($INTERVAL - (time() - $timestamp));
+  }
 }
 close OUT;
 



More information about the Orca-checkins mailing list