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();
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;
$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+)/ );
if (isdbg('raw')) {
dbgdump('raw', "AGW send $bytes_written: ", $msg);
}
+ $total_out += $bytes_written;
$offset += $bytes_written;
$bytes_to_write -= $bytes_written;
}
$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);
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 = ();
$rd_handles = IO::Select->new();
$wt_handles = IO::Select->new();
$er_handles = IO::Select->new();
+$total_in = $total_out = 0;
$now = time;
my $call = $conn->{call} || 'none';
dbgdump('raw', "$call send $bytes_written: ", $msg);
}
+ $total_out += $bytes_written;
$offset += $bytes_written;
$bytes_to_write -= $bytes_written;
}
$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);