add S.M.A.R.T. data collector
[metriccd.git] / client / meter / conntrack
blob8d503801a1c33d2727d934f0a95f60692b403cc3
1 #!/usr/bin/env perl
3 require "common.pl";
5 open $fh, '<', '/proc/net/nf_conntrack' or die "$0: /proc/net/nf_conntrack: $!\n";
6 while(<$fh>)
8 my ($af, $proto) = /^(\S+)\s+\S+\s+(\S+)/;
9 $Conntrack{'af'}->{$af}++;
10 $Conntrack{'proto'}->{$proto}++;
11 for my $flag (/([A-Z_]+)/g)
13 $Conntrack{'flag'}->{$flag}++;
16 close $fh;
19 open $fh, '-|', 'conntrack', '-S' or die "$0: $!\n";
20 while(<$fh>)
22 s/cpu=\d+\s+//;
23 while(s/^([^\s=]+)=(\d+)\s*//)
25 $Conntrack{'stat'}->{$1} += $2;
28 close $fh;
31 svlhk_dump(\%Conntrack);