]> dxcluster.org Git - spider.git/commitdiff
more mrtg, store in 10ths and display to 0.1 sec
authorDirk Koopman <djk@tobit.co.uk>
Thu, 17 Nov 2016 16:10:39 +0000 (16:10 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Thu, 17 Nov 2016 16:10:39 +0000 (16:10 +0000)
cmd/mrtg.pl
perl/DXChannel.pm
perl/Mrtg.pm
perl/cluster.pl

index 9339f0fc61e7c764127f71e3ff1f2624e4b5eba0..ce1d1020652cd4cab88a99089177989293b91fea 100644 (file)
@@ -80,8 +80,8 @@ sub do_it
                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 10th of secs",
-                                         '10th Secs/min', 'Cluster Secs*10', 'Child Secs*10') unless $want{dataonly};
+                                         "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};
        }
 
index 7526099e895ccff4d0d86a47c7e69ccc857ee0ef..91900e4b3c8a360118e25075993ba8387cd20a18 100644 (file)
@@ -19,7 +19,7 @@
 # firstly and OO about ninthly (if you don't like the design and you can't 
 # improve it with better OO and thus make it smaller and more efficient, then tough). 
 #
-# Copyright (c) 1998-2000 - Dirk Koopman G1TLH
+# Copyright (c) 1998-2016 - Dirk Koopman G1TLH
 #
 #
 #
@@ -171,7 +171,7 @@ sub alloc
        if (@dxcc > 0) {
                $self->{dxcc} = $dxcc[1]->dxcc;
                $self->{itu} = $dxcc[1]->itu;
-               $self->{cq} = $dxcc[1]->cq;                                             
+               $self->{cq} = $dxcc[1]->cq;
        }
        $self->{inqueue} = [];
 
index 29e1259a3d840c8abf1df2a1f3db057dfe9568ca..d95c41cb19ed65bd46c7ead69d341904959f4638 100644 (file)
@@ -68,8 +68,9 @@ sub data
 
 sub cfgprint
 {
-       my ($self, $name, $options, $max, $title, $legend, $iname, $oname) = @_;
+       my ($self, $name, $options, $max, $title, $legend, $iname, $oname, $yticsfactor) = @_;
        my $opt = join ', ', @$options, qw(withzeroes growright nopercent integer);
+       $yticsfactor ||= 1;
 
        $self->{mc}->print(<<"EOF");
 
@@ -82,7 +83,7 @@ MaxBytes[$name]: $max
 Title[$name]: $title
 Options[$name]: $opt
 YLegend[$name]: $legend
-YTicsFactor[$name]: 1
+YTicsFactor[$name]: $yticsfactor
 ShortLegend[$name]: \&nbsp;
 Legend1[$name]:Maximum No of $iname
 Legend2[$name]:Maximum No of $oname
index 1419e318e15d5e704045c1fd764201cf8faf0e7c..4222132c2b982bee9fe2490d99cab9ca184ab224 100755 (executable)
@@ -352,77 +352,6 @@ sub AGWrestart
        AGWMsg::init(\&new_channel);
 }
 
-our $io_disconnected;
-
-sub idle_loop
-{
-       my $timenow = time;
-
-       BPQMsg::process();
-#      DXChannel::process();
-
-       #      $DB::trace = 0;
-
-       # do timed stuff, ongoing processing happens one a second
-       if ($timenow != $systime) {
-               reap() if $zombies;
-               $systime = $timenow;
-               my $days = int ($systime / 86400);
-               if ($systime_days != $days) {
-                       $systime_days = $days;
-                       $systime_daystart = $days * 86400;
-               }
-               IsoTime::update($systime);
-               DXCron::process();      # do cron jobs
-               DXCommandmode::process(); # process ongoing command mode stuff
-               DXXml::process();
-               DXProt::process();              # process ongoing ak1a pcxx stuff
-               DXConnect::process();
-               DXMsg::process();
-               DXDb::process();
-               DXUser::process();
-               DXDupe::process();
-               DXCron::process();                      # do cron jobs
-               IsoTime::update($systime);
-               DXProt::process();                      # process ongoing ak1a pcxx stuff
-               DXConnect::process();
-               DXUser::process();
-               AGWMsg::process();
-               
-               Timer::handler();
-               DXLog::flushall();
-       }
-
-       if (defined &Local::process) {
-               eval {
-                       Local::process();       # do any localised processing
-               };
-               dbg("Local::process error $@") if $@;
-       }
-
-       while ($ending) {
-               my $dxchan;
-
-               dbg("DXSpider Ending $ending");
-
-               unless ($io_disconnected++) {
-
-                       # disconnect users
-                       foreach $dxchan (DXChannel::get_all_users) {
-                               $dxchan->disconnect;
-                       }
-
-                       # disconnect nodes
-                       foreach $dxchan (DXChannel::get_all_nodes) {
-                               next if $dxchan == $main::me;
-                               $dxchan->disconnect(2);
-                       }
-                       $main::me->disconnect;
-               }
-
-               Mojo::IOLoop->stop if --$ending <= 0;
-       }
-}
 
 sub setup_start
 {
@@ -648,12 +577,112 @@ sub setup_start
        #open(DB::OUT, "|tee /tmp/aa");
 }
 
+our $io_disconnected;
+
+sub idle_loop
+{
+       BPQMsg::process();
+
+       if (defined &Local::process) {
+               eval {
+                       Local::process();       # do any localised processing
+               };
+               dbg("Local::process error $@") if $@;
+       }
+
+       while ($ending) {
+               my $dxchan;
+
+               dbg("DXSpider Ending $ending");
+
+               unless ($io_disconnected++) {
+
+                       # disconnect users
+                       foreach $dxchan (DXChannel::get_all_users) {
+                               $dxchan->disconnect;
+                       }
+
+                       # disconnect nodes
+                       foreach $dxchan (DXChannel::get_all_nodes) {
+                               next if $dxchan == $main::me;
+                               $dxchan->disconnect(2);
+                       }
+                       $main::me->disconnect;
+               }
+
+               Mojo::IOLoop->stop if --$ending <= 0;
+       }
+}
+
+sub per_sec
+{
+       my $timenow = time;
+
+       reap() if $zombies;
+       $systime = $timenow;
+       my $days = int ($systime / 86400);
+       if ($systime_days != $days) {
+               $systime_days = $days;
+               $systime_daystart = $days * 86400;
+       }
+       IsoTime::update($systime);
+       DXCron::process();      # do cron jobs
+       DXCommandmode::process(); # process ongoing command mode stuff
+       DXXml::process();
+       DXProt::process();              # process ongoing ak1a pcxx stuff
+       DXConnect::process();
+       DXMsg::process();
+       DXDb::process();
+       DXUser::process();
+       DXDupe::process();
+       DXCron::process();                      # do cron jobs
+       IsoTime::update($systime);
+       DXProt::process();                      # process ongoing ak1a pcxx stuff
+       DXConnect::process();
+       DXUser::process();
+       AGWMsg::process();
+       
+       Timer::handler();
+       DXLog::flushall();
+}
+
+sub per_10_sec
+{
+
+}
+
+
+sub per_minute
+{
+
+}
+
+sub per_10_minute
+{
+
+}
+
+sub per_hour
+{
+
+}
+
+sub per_day
+{
+
+}
 
 setup_start();
 
 my $main_loop = Mojo::IOLoop->recurring($idle_interval => \&idle_loop);
 my $log_flush_loop = Mojo::IOLoop->recurring($log_flush_interval => \&DXLog::flushall);
 my $cpusecs_loop = Mojo::IOLoop->recurring(5 => sub {my @t = times; $clssecs = $t[0]+$t[1]; $cldsecs = $t[2]+$t[3]});
+my $persec =  Mojo::IOLoop->recurring(1 => \&per_sec);
+my $per10sec =  Mojo::IOLoop->recurring(10 => \&per_10_sec);
+my $permin =  Mojo::IOLoop->recurring(60 => \&per_minute);
+my $per10min =  Mojo::IOLoop->recurring(600 => \&per_10_minute);
+my $perhour =  Mojo::IOLoop->recurring(3600 => \&per_hour);
+my $perday =  Mojo::IOLoop->recurring(86400 => \&per_day);
 
 Web::start_node();