package HotSaNICmod::OSdep; sub version { ($VERSION = '$Revision: 1.4 $') =~ s/.*(\d+\.\d+).*/$1/; return "$^O.pm $VERSION"; } sub sample { my %args=@_; my @values=(0,0,0,0,0,0,0,0,0,0,0,0); open FILE,"/proc/net/tcp"; while () { (undef,undef,undef,$state)=split; if ($state =~ /[0-9A-F]+/) { if ($state =~ /^0/) { $state =~ s/^0//; if ($state eq "A") { $state=10; } elsif ($state eq "B") { $state=11; } elsif ($state !~ /[0-9]/) { $state=0; } } else { $state=0; } $values[$state]++; } } close FILE; HotSaNICmod::do_rrd("connections","U",time,@values); } 1; # known states: # # 01=ESTABLISHED 02=SYN_SENT 03=SYN_RECV 04=FIN_WAIT1 05=FIN_WAIT2 # 06=TIME_WAIT 07=CLOSE 09=LAST_ACK 0A=LISTEN 0B=CLOSING # TODO: # # this module only stats local connections. # # to stat ALL (i.e. including masq'ed) connections: use /proc/net/ip_conntrack # select all lines containing "tcp" as 1st keyword # the connection state can be found in plaintext on pos. #4 # # ATTENTION: This stat also contains the connections to the local configured IPs! # # format of ip_conntrack: # # # # for more details see: # http://www.faqs.org/docs/iptables/theconntrackentries.html # /net/ipv4/netfilter/ip_conntrack.c # /include/linux/netfilter_ipv4/ip_conntrack.h WebSVN - hotsanic - Blame - Rev 9 - /branches/HotSaNIC-0.5.0-pre6/modules/netstat/platform/linux.pm
  jablonka.czprosek.czf

hotsanic

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

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1