package HotSaNICmod::OSdep; sub version { ($VERSION = '$Revision: 1.7 $') =~ s/.*(\d+\.\d+).*/$1/; return "$^O.pm $VERSION"; } sub sample { my %args=@_; my %devin; my %devout; my %sampletime; # first sample device stats # # untested, but very similar to FreeBSD so should work. will test soon. open(IN,"netstat -ib | grep Link |"); while() { chomp; s/[0-9a-f]{2}(:([0-9a-f]{2})){5}//; # remove mac address ($name, $d, $d, $input, $output)=split; $devin{$name}=$input; $devout{$name}=$output; $sampletime{$name}=time; } close(IN); # then feed all configured items into the DBs # foreach my $entry (@{$args{DEV}}) { my ($host,undef,$item,$dbname,undef,undef,$description,$maxin,$maxout)=HotSaNICmod::common::get_names($entry); if ($host eq "") { my $devin=$devin{$item} || "U"; my $devout=$devout{$item} || "U"; my $sampletime=$sampletime{$item} || time; # if max-transmission is not set, assume 100 MBit. # my $max=$maxin; if ($max < $maxout) { $max=$maxout }; if ($max == 0) { $max=12500000; } HotSaNICmod::do_rrd($dbname,$max,$sampletime,$devin,$devout); } } } 1; WebSVN - hotsanic - Blame - Rev 9 - /branches/HotSaNIC-0.5.0-pre6/modules/traffic/platform/openbsd.pm
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [traffic/] [platform/] [openbsd.pm] - Blame information for rev 9

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1