mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-27 06:59:42 +02:00
bin/snmp6: monitor IPv6 statistics in /proc/net/snmp6
This commit is contained in:
parent
0153edd639
commit
b99342358f
29
bin/snmp6
Executable file
29
bin/snmp6
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# Show /proc/net/snmp6 continuously. Loosely based on
|
||||||
|
# http://svn.openmoko.org//developers/werner/bin/snmp
|
||||||
|
#
|
||||||
|
# usage: snmp6 <interval>
|
||||||
|
#
|
||||||
|
$SNMP = "/proc/net/snmp6";
|
||||||
|
$LINE = 78;
|
||||||
|
$continuous = $ARGV[0];
|
||||||
|
do {
|
||||||
|
open(PROC, $SNMP) || die "open $SNMP: $!";
|
||||||
|
while (<PROC>) {
|
||||||
|
die unless /^(\S+)(\s+)(\d+)$/;
|
||||||
|
if (!defined $last{$1}) {
|
||||||
|
print;
|
||||||
|
} elsif ($last{$1} != $3) {
|
||||||
|
printf "$1$2%+d\n", $3-$last{$1};
|
||||||
|
}
|
||||||
|
$last{$1} = $3;
|
||||||
|
}
|
||||||
|
close(PROC);
|
||||||
|
|
||||||
|
if ($continuous) {
|
||||||
|
sleep($continuous);
|
||||||
|
print (("-"x$LINE)."\n");
|
||||||
|
}
|
||||||
|
$more = 1;
|
||||||
|
}
|
||||||
|
until (!$continuous);
|
Loading…
Reference in New Issue
Block a user