Re: In/Out Traffic erfassen

From: Dominik Brettnacher <domi(at)saargate.de>
Date: Mon, 3 Dec 2001 20:25:27 +0100 (CET)

On Mon, 3 Dec 2001, Oliver Fromme wrote:

> Wenn Du willst, kannst Du das auch in MRTG füttern (ist in
> den Ports) und bunte Bilderchen daraus generieren. :-)

Genau, zum Beispiel hiermit:

#!/usr/bin/perl

$if = shift;

open(NETSTAT,"/usr/bin/netstat -bnI $if |");

while(<NETSTAT>)
{

m/^$if.*\s([0-9-]+)\s+([0-9-]+)\s+([0-9-]+)\s+([0-9-]+)\s+([0-9-]+)\s+([0-9-]+)\s+([0-9-]+)$/;

        $in = $3;
        $out = $6;
}

close(NETSTAT);

print "$in\n$out\n";

-- 
Dominik - http://www.brettnacher.org/users/dominik/
"My brain is built of paths and slides and ladders and lasers and I have
 invited all of you to enter its pavillon. My brain, as you enter, will
 smell of tangerines and brand-new running shoes."
			-- Douglas Coupland
To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Mon 03 Dec 2001 - 20:31:30 CET

search this site