add in and out stats for data into the cluster
authorminima <minima>
Sun, 29 Sep 2002 22:46:00 +0000 (22:46 +0000)
committerminima <minima>
Sun, 29 Sep 2002 22:46:00 +0000 (22:46 +0000)
cmd/mrtg.pl
perl/AGWMsg.pm
perl/Msg.pm

index 05d426e26266bf2174a08582b4a98b58154e0cee..dfc0fcb5050661f81e0827cec76066ed19231220 100644 (file)
@@ -36,6 +36,20 @@ $want{nomrtg} = 1 if $want{cfgonly} || $want{test};
 return (1, "MRTG not installed") unless $want{nomrtg} || -e '/usr/bin/mrtg' || -e '/usr/local/bin/mrtg';
 
 my $mc = new Mrtg or return (1, "cannot initialise Mrtg $!");
+
+# do Msg totals
+$mc->cfgprint('msg', [], 64000, 
+                "Data in and out of $main::mycall",
+                'Bits / Sec', 'Bytes In', 'Bytes Out') unless $want{dataonly};
+$mc->data('msg', $Msg::total_in, $Msg::total_out, "Data in and out of $main::mycall") unless $want{cfgonly};
+
+# do AGW stats if they apply
+if ($want{agw}) {
+       $mc->cfgprint('agw', [], 64000, 
+                                 "AGW Data in and out of $main::mycall",
+                                 'Bits / Sec', 'Bytes In', 'Bytes Out') unless $want{dataonly};
+       $mc->data('agw', $AGWMsg::total_in, $AGWMsg::total_out, "AGW Data in and out of $main::mycall") unless $want{cfgonly};
+}
                         
 # do the users and nodes
 my $users = DXChannel::get_all_users();
index 693f31085235cc6105301d403251e7fbceffe76f..d6828812f2f31dbd2684b3143db3575bbae39647 100644 (file)
@@ -30,7 +30,7 @@ use AGWConnect;
 use DXDebug;
 
 use vars qw(@ISA $sock @outqueue $send_offset $inmsg $rproc $noports $lastytime 
-                       $lasthtime $ypolltime $hpolltime %circuit);
+                       $lasthtime $ypolltime $hpolltime %circuit $total_in $total_out);
 
 @ISA = qw(Msg ExtMsg);
 $sock = undef;
@@ -43,6 +43,7 @@ $lastytime = $lasthtime = time;
 $ypolltime = 10 unless defined $ypolltime;
 $hpolltime = 300 unless defined $hpolltime;
 %circuit = ();
+$total_in = $total_out = 0;
 
 use vars qw($VERSION $BRANCH);
 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
@@ -171,6 +172,7 @@ sub _send
                        if (isdbg('raw')) {
                                dbgdump('raw', "AGW send $bytes_written: ", $msg);
                        }
+            $total_out      += $bytes_written;
             $offset         += $bytes_written;
             $bytes_to_write -= $bytes_written;
         }
@@ -196,6 +198,7 @@ sub _rcv {                     # Complement to _send
        $bytes_read = sysread ($sock, $msg, 1024, 0);
        if (defined ($bytes_read)) {
                if ($bytes_read > 0) {
+            $total_in += $bytes_read;
                        $inmsg .= $msg;
                        if (isdbg('raw')) {
                                dbgdump('raw', "AGW read $bytes_read: ", $msg);
index 45c0ab7c48b68f6bdd2f80d2a8fbd3c027ef0f57..c3637fb0bf6843320e97bf0c658e19345007c073 100644 (file)
@@ -23,7 +23,7 @@ use IO::Socket;
 use DXDebug;
 use Timer;
 
-use vars qw(%rd_callbacks %wt_callbacks %er_callbacks $rd_handles $wt_handles $er_handles $now %conns $noconns $blocking_supported $cnum);
+use vars qw(%rd_callbacks %wt_callbacks %er_callbacks $rd_handles $wt_handles $er_handles $now %conns $noconns $blocking_supported $cnum $total_in $total_out);
 
 %rd_callbacks = ();
 %wt_callbacks = ();
@@ -31,6 +31,7 @@ use vars qw(%rd_callbacks %wt_callbacks %er_callbacks $rd_handles $wt_handles $e
 $rd_handles   = IO::Select->new();
 $wt_handles   = IO::Select->new();
 $er_handles   = IO::Select->new();
+$total_in = $total_out = 0;
 
 $now = time;
 
@@ -378,6 +379,7 @@ sub _send {
                                my $call = $conn->{call} || 'none';
                                dbgdump('raw', "$call send $bytes_written: ", $msg);
                        }
+                       $total_out      += $bytes_written;
             $offset         += $bytes_written;
             $bytes_to_write -= $bytes_written;
         }
@@ -503,6 +505,7 @@ sub _rcv {                     # Complement to _send
        $bytes_read = sysread ($sock, $msg, 1024, 0);
        if (defined ($bytes_read)) {
                if ($bytes_read > 0) {
+                       $total_in += $bytes_read;
                        if (isdbg('raw')) {
                                my $call = $conn->{call} || 'none';
                                dbgdump('raw', "$call read $bytes_read: ", $msg);