|Ako zad edin mrejov interfeis imam poveche ot edna mreji, moga li da nakaram MRTG-to |da chertae grafiki za vsiaka mreja pootdelno, a ne za obshtia trafik preminavasht |prez interfeisa ?
]- eto nesto tuka deto bqh pochnal da pisha.... (mai ste trqbwa da si go dowyrsha, ]stoto ste mi trqbwa:")).. za ideq kak da extraktwash infoto ot iptables... posle go chrez RRDs.pm go pishesh w rrd bazi, i posle chertaesh grafiki... =====blah.pl============== #!/usr/bin/perl package SA::IPTExtract; sub new { my $this = shift; my $class = ref($this) || $this; my $self = {}; bless $self, $class; $self->capture; return $self; } sub display { my $self = shift; foreach my $c (keys %{$$self{stat}}) { print "Chain : $c\n"; foreach my $k (keys %{$$self{stat}{$c}}) { print "$k ==> $$self{stat}{$c}{$k}\n" } } } sub capture { my $self = shift; my $output = qx{iptables -L -v -n}; my @chains = $output =~ /(?:^|(Chain.+?))(?:\n\n|$)/gs; for my $c (@chains) { #get chain name my ($name) = $c =~ /Chain (\S+)?/; #remove header info $c =~ s/Chain.+destination//s; #walk all rules for my $line (split /\n/, $c) { my ($bytes,$src,$dst) = (split /\s+/,$line)[1,7,8]; $$self{stat}{$name}{"$src-$dst"} = $bytes; } # print "$name\n"; # print "$c\n-----\n"; }; } 1; #============ package main; use Data::Dumper; my $ipt = new SA::IPTExtract(); $ipt->display; #print Dumper $ipt; ============================================================================ A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers). http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html ============================================================================