What you will need to do is go and have a look at www.mrtg.org
Have a look at this script... This does a telnet into the router and pulls
the relevent traffic counters out for mrtg.
This is the latest version I have here at work, so if it doesnt work, email
me at home (the address at bottom of script) and I will send you the latest
version. You will need the Net::Telnet module from CPAN.
cheers
Rob
--- snip ---
#!/usr/bin/perl -w
# logon to alcatel adsl router and get connection stats for mrtg
#
# mrtg expects 4 lines returned:
# Line 1: current state of the first variable, normally 'incoming
bytes count'
# Line 2: current state of the second variable, normally 'outgoing
bytes count'
# Line 3: string (in any human readable format), telling the uptime of
the target.
# Line 4: string, telling the name of the target.
use strict;
use Net::Telnet ();
# set up some user variables
my $AlcatelHost = 'hostname'; #modify this one
my $AlcatelPasswd = 'password'; #modify this one
my $AlcatelUser = ''; #dont modify
# end of variables
my $IntName;
if ($ARGV[0]) {
$IntName = $ARGV[0];
} else {
UsageText();
}
my $conn = new Net::Telnet (Prompt => '/\=>$/i');
# uncomment these two lines for debug logfiles
#$conn->input_log('test1.txt');
#$conn->dump_log('test.txt');
# connect and logon
$conn->open($AlcatelHost);
$conn->waitfor('/User : $/i');
$conn->print($AlcatelUser);
$conn->waitfor('/Password : $/i');
$conn->print($AlcatelPasswd);
# retrieve 'ip aplist' command output
my @output = $conn->cmd("ip aplist");
$conn->close;
#print @output; #uncomment to debug output
# loop through output array. Find the ADSL interface specified at
# program start and then get the RX / TX stats for that interface.
# drop out of loop after match as can have multiple ints of same name.
my $i = 0;
until (!$output[$i]) {
if ($output[$i] =~ /\s$IntName\s/) {
my $a = $i + 3;
print "$1\n" if $output[$a] =~ /bytes:([0-9]+)/g; #in bytes
print "$1\n" if $output[++$a] =~ /bytes:([0-9]+)/; #out
bytes
print "its 1am\n"; #time string
print "$IntName\n"; #host name - in this case interface
last;
}
$i++;
}
sub UsageText
{
die <<HELPTEXT;
getstats.pl v1.0
----------------
Used to retrieve interface statistics from Alcatel Speedtouch
due to lack of SNMP availability on the internal interface.
The interface names can be determined by doing a 'ip aplist'
from the Alcatel's CLI.
----------------
Rob Harrowfield
robboh\@xtra.co.nz
Usage: getstats [interfacename]
eg: getstats ADSLNZ
HELPTEXT
}
--- snip ----
> -----Original Message-----
> From: Nick Johnson [mailto:arachnid@mad.scientist.com]
> Sent: 3 April 2002 6:15PM
> To: adsl@lists.unixathome.org
> Subject: [OT] Traffic monitoring on DSL link
>
>
> Hi all,
>
> I've got a Jetstart ADSL connection, terminated with an
> Alcatel Speed Touch
> Home, hooked up to an old 486 I have running linux and doing
> NATing/Firewalling. Unfortunately, the STHome does not seem to support
> traffic graphing, so I've been looking for other ways to do it.
--
The information contained in this e-mail message is intended only for the use of the person or entity to whom it is addressed and may contain information that is CONFIDENTIAL and may be exempt from disclosure under applicable laws.
If you read this message and are not the addressee you are notified that use, dissemination, distribution, or reproduction of this message is prohibited. If you have received this message in error, please notify us immediately and delete the original message. You should scan this message and any attached files for viruses.
Axon Computertime accepts no liability for any loss caused either directly or indirectly by a virus arising from the use of this message or any attached file.
--
This message is part of the NZ ADSL mailing list.
see http://unixathome.org/adsl/ for archives, FAQ,
and various documents.
To unsubscribe: send mail to majordomo@lists.unixathome.org
with "unsubscribe adsl" in the body of the message
Received on Fri Apr 5 08:34:32 2002