#! @PREFIX@/bin/perl # $NetBSD: netstat2mrtg,v 1.3 2001/06/21 16:44:35 bouyer Exp $ $if = $ARGV[0]; open(NET, "netstat -I $if -bn|"); while ($line = ) { chop $line; if ($line =~ m|^.+[\s\t]+\S+[\s\t]+(\w+)[\s\t]+(\w+)$|) { print "$1\n"; print "$2\n"; } elsif ($line =~ m|^.+[\s\t]+(\w+)[\s\t]+(\w+)$|) { print "$1\n"; print "$2\n"; } } close(NET); open(UP, "uptime|"); while($line = ) { chop $line; if ($line =~ m|^.*up\s+(.+),\s+\d+\suser.*|) { print "$1\n"; } } close(UP); print "$if\n";