package HotSaNICmod::OSdep; use RRDs; sub version { ($VERSION = '$Revision: 1.0 $') =~ s/.*(\d+\.\d+).*/$1/; my $platform; foreach (keys(%INC)) { $platform=$_ if $_ =~ /platform/; } return "$platform $VERSION"; } sub sample { #uncomment this for debug output to temp.txt #all print will be done into the file #$temp = "/opt/HotSaNIC/modules/bgp/temp.txt"; #open (TEMPFILE,">$temp"); #open (STDERR,">&TEMPFILE") || die ("open STDERR failed"); #open (STDOUT,">&TEMPFILE") || die ("open STDOUT failed"); my %args=@_; $mtime=(stat("rrd"))[9]; $now=time; utime $now,$now,"rrd"; $IWCONF = $args{IWCONFIG}; $IWLIST = $args{IWLIST}; $hostap = $args{HOSTAP}; my @IFACES=(); my @IFMACS=(); foreach (keys(%args)) { if (index($_,"IFACE:") >=0 ) { (undef,$device)=split /:/; push @IFACES,$device; } } foreach (keys(%args)) { if (index($_,"MAC,") >=0 ) { (undef,$dev,$mac)=split /,/; push @IFMACS,"$dev,$mac"; } } foreach $device (@IFACES) { if ( ! -e "rrd/$device.rrd" ) { system("./makerrd","$device","U") } } # foreach my $asnum = 0; my $pathlen = 0; my $refcnt = 0; my $signal = 0; my $voltage = 0; $command = "cat /tmp/bgp.txt"; open (FILE,"$command|"); while(
) { $var=$_; if ($var =~ /^10/) { @path=split(" ",$var); $pathlen=scalar(@path); if ($pathlen > 2) { # print "line: $pathlen"; # print "line: $_"; $asnum = $path[$pathlen-2]; $pathlen = $pathlen-2; # print "$asnum $pathlen\n"; if ( ! -e "rrd/$asnum.rrd" ) { system("./makerrd","$asnum","U") } RRDs::update "rrd/$asnum.rrd",time.":".$pathlen.":".$refcnt.":".$signal.":".$voltage; # if ($ERROR = RRDs::error) { print time," ",$MODNAME,": unable to update `$asnum.rrd': $ERROR"; } if ($ERROR = RRDs::error) { print time," bgp: unable to update `$asnum.rrd': $ERROR\n"; } $pathlen = 0; } } } # while close(FILE); #uncomment this for debug output to temp.txt #all print will be done into the file # close (TEMPFILE); # close (STDERR); # close (STDOUT); } 1;
WebSVN - hotsanic - Blame - Rev 31 - /trunk/modules/bgp/platform/default.pm
Català-Valencià - Catalan
Česky - Cesky
Dansk - Dansk
Dutch - Dutch
English - English
Finnish - Finnish
Français - Francais
Deutsch - German
עברית - Hebrew
Magyar - Hungarian
Bahasa Indonesia - Indonesian
Italiano - Italian
日本語 - Japanese
한국어 - Korean
Norsk - Norwegian
Polski - Polish
Português - Portuguese
Português - Brazilian Portuguese
Русский - Russian
中文 - Simplified Chinese
Slovenčina - Slovak
Slovenčina - Slovenian
Español - Spanish
Svenska - Swedish
中文 - Traditional Chinese
Türkçe - Turkish
Oëzbekcha - Uzbek
hotsanic
Subversion Repositories:
banderdyn
centos.prosek.czf
crusader
czf4bfu
czf4bfu.prosek.czf
czfcentos
czfgmap
discover
fedora.prosek.czf
freenet-router
ftth
getonlineclouds
hotsanic
internet.prosek.czf
is
mapstats
meteolinger
netmap
qos
sedlo
sedlo.prosek.czf
switches
vbtobb
vlubnt
weathermap
weatherstats
websvn
wifidashboard
wifimon
www.prosek.czf
xenstats
[
/
] [
trunk/
] [
modules/
] [
bgp/
] [
platform/
] [
default.pm
] - Blame information for rev
31
Line No.
Rev
Author
Line
Powered by
WebSVN
2.2.1