Hi,
Iam looking for a script that gives me the in/out from my eth0 NIC, is there such a script?
I can`t find it..
Thanks,
banaan
ifconfig - in out
Moderators: Developers, Moderators
It looks like this post may contain the script you are requesting:
http://www.raxnet.net/board/viewtopic.php?p=1784#1784
-Ian
http://www.raxnet.net/board/viewtopic.php?p=1784#1784
-Ian
Here's one I wrote earlier today:
Code: Select all
#!/usr/bin/perl
open(IN,"/proc/net/dev");
while(<IN>) {
chomp;
#if ((index($_,"Int")<0) && (index($_,"byte")<0)) {
if ( /:/ ) {
($combined, $a, $d, $d, $d, $d, $d, $d, $output, $e)=split;
($name, $input)=split(":",$combined);
if(!$input) { ($input, $output) = ($a, $e); }
$devin{$name}=$input;
$devout{$name}=$output;
# $sampletime{$name}=time;
}
}
close(IN);
# The format is in <Receive/In Bytes> <Transmit/Out Bytes>
# You can do more than one interfaces at a time, like:
# bandwidth.pl eth0 lo
# and it will return eth0-in eth0-out lo-in lo-out
if (@ARGV) {
foreach $argv (@ARGV) {
push(@output,"$devin{lc($argv)} $devout{lc($argv)}");
}
print "@output";
}
Who is online
Users browsing this forum: No registered users and 2 guests