]> git.etc.gen.nz Git - spong.git/commitdiff
General bug fixed and minor functional changes.
authorStephen L Johnson <sjohnson@monsters.org>
Tue, 28 Dec 1999 20:35:35 +0000 (20:35 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Tue, 28 Dec 1999 20:35:35 +0000 (20:35 +0000)
contrib/plugins/spong-server/data_rrd_disk
contrib/plugins/spong-server/data_rrd_la

index ad0f04c68edd047cf79f33c16179704f79758914..3e0cac65a0587b8ea32bcf24c6be743ecb3e5a5e 100755 (executable)
@@ -2,6 +2,7 @@
 $DATAFUNCS{'rrd_disks'} = \&data_rrd_disks;
 
 use Data::Dumper;
+use File::Basename;
 
 # Take the disk status messages and create rrd databases for each of 
 # mount point. Skipping the @DFIGNORE mount points.
@@ -24,7 +25,7 @@ sub data_rrd_disks {
 
    my( $line, $rawfs, $used, $pct, $name, %namemap, $target );
 
-   &main::save_data('>', "$RRDDIR/$host/disk-name-map", "");
+   &main::save_data('>', "$RRDDIR/$host/.rrd-disk", "");
 
    foreach $line ( split(/\n/,$message) ) {
       if ( $line =~ m!^(\S+)\s.*\s(\d+)\s+\d+\s+(\d+)%\s+[^/]*(/.*)$! ) {
@@ -76,10 +77,8 @@ sub data_rrd_disks {
 
    }
 
-print Data::Dumper->Dump([\%namemap],['$namemap']);
    $line = "";
    while(($k,$v) = (each %namemap)) {
-print "\$k = $k, \$v = $v\n";
       $line .= "$k:$v\n";
    }
 
index 687617750b95c0803300279b02543dc24e7f6893..35589eea7da749e26911743d96a1f9ba575d7941 100755 (executable)
@@ -22,9 +22,9 @@ sub data_rrd_la {
 
    my( $line, $rawfs, $used, $pct, $name, %namemap, $target );
 
-   &main::save_data('>', "$RRDDIR/$host/name-map", "");
+   &main::save_data('>', "$RRDDIR/$host/.rrd-la", "");
 
-   if ( $sum =~ m/load\s+=\s+([^, ]),\s+([\d]+)\s+users,\s+(\d+)/ ) {
+   if ( $sum =~ m/load\s+=\s+([^,]+),\s+([\d]+)\s+users,\s+(\d+)/ ) {
       ( $load, $users, $jobs ) = ( $1, $2, $3 );
 
       # If .rrd file not found, built it
@@ -36,14 +36,14 @@ sub data_rrd_la {
            eval {
               system "$RRDTOOL create $RRDDIR/$host/la.rrd " . 
                      "DS:loadavg:GAUGE:600:0:100 DS:users:GAUGE:600:0:U " .
-                     "DS:GAUGE:600:0:U $RRAS";
+                     "DS:jobs:GAUGE:600:0:U $RRAS";
            };
          }
          if (@?) { &error("Error: rrdtool create: $@"); }
       }
 
       # Update the .rrd file
-      &debug("Updating $host $name rrd file");
+      &debug("Updating $host Load Avg rrd file");
       {  local $SIG{'PIPE'} = 'IGNORE';
          local $SIG{'CHLD'} = 'IGNORE';