remove active debugging from mds
[spider.git] / cmd / mrtg.pl
index aeaab2e70e48245f2af473115c2e1604a4250762..f60e06655ba950e577fa16e995ece4ba67814ea8 100644 (file)
@@ -33,7 +33,7 @@ sub handle
 {
        my ($self, $line) = @_;
 
-       $DB::single = 1;
+#      $DB::single = 1;
        
        # create the arg list
        my %want;
@@ -75,31 +75,14 @@ sub do_it
        }
 
        if (!$main::is_win && ($want{proc} || $want{all})) {
-               $ENV{COLUMNS} = 250;
-               my $secs;
-               my $f = new IO::File "top -b -o TIME+ -n 1 -c |";
-               #       dbg("$f");
-               if ($f) {
-                       while (<$f>) {
-                               chomp;
-                               my $l = $_;
-                               dbg("mrtg: $l") if isdbg("mrtg");
-                               next unless $l =~ m{cluster\.pl$};
-                               next if $l =~ m{\d\s+su\s+};
-                               next if $l =~ m{\d\s+bash\s+};
-                               my @f = split /\s+/, $l;
-                               my ($m, $s) = $f[10] =~ /\b(\d+):(\d\d\.\d\d)\b/;
-                               $secs = ($m * 60) + $s;
-                               dbg("mrtg: proc: $f[10] m: $m s: $s secs: $secs") if isdbg("mrtg");
-                               last;
-                       }
-                       $f->close;
-
-                       $mc->cfgprint('proc', [qw(noi unknaszero withzeroes perminute)], 5*60, 
-                                                 "Processor Usage",
-                                                 'Proc Secs/Min', 'Proc Secs', 'Proc Secs') unless $want{dataonly};
-                       $mc->data('proc', $secs, $secs, "Processor Usage") unless $want{cfgonly};
-               }
+               my $secs = $main::clssecs + $main::cldsecs;
+
+               dbg "mrtg: proc: cluster=$main::clssecs children=$main::cldsecs clock=$secs" if isdbg('mrtg');
+               
+               $mc->cfgprint('proc', [qw(unknaszero withzeroes perminute)], 600, 
+                                         "CPU Usage of <font color=#00cc00>node</font> and its <font color=#0000ff>children</font> in seconds",
+                                         'CPU Secs/min', 'Node Secs 10ths', 'Child Secs 10ths', 0.1) unless $want{dataonly};
+               $mc->data('proc', int($main::clssecs*10+0.5), int($main::cldsecs*10+0.5), "Processor Usage") unless $want{cfgonly};
        }
 
        # do the users and nodes