5 fw_forwarded_local - Plugin to monitor network connections.
9 This plugin must run with root privileges
11 =head2 CONFIGURATION EXAMPLE
13 /etc/munin/plugin-conf.d/global or other file in that dir must contain:
22 =item * forward: number of connections forwarded
24 =item * local: number of connections for the host itself
30 2011.09.23: Perl version by Alex Tomlins
35 #%# capabilities=autoconf
42 my $conntrack = '/usr/sbin/conntrack';
43 my $nf_conntrack_file = '/proc/net/nf_conntrack';
44 my $ip_conntrack_file = '/proc/net/ip_conntrack';
46 if ( defined($ARGV[0]) and $ARGV[0] eq "autoconf" ) {
47 if ( -x $conntrack or -r $nf_conntrack_file or -r $ip_conntrack_file) {
55 if ( defined($ARGV[0]) and $ARGV[0] eq "config" ) {
56 print "graph_title ipconntrack\n";
57 print "graph_args -l 0 --base 1000\n";
58 print "graph_vlabel established connections\n";
59 print "graph_category network\n";
60 print "forward.label forward\n";
61 print "forward.type GAUGE\n";
62 print "local.label local\n";
63 print "local.type GAUGE\n";
69 $command = "$conntrack -L -o extended 2>/dev/null";
70 } elsif ( -r $nf_conntrack_file ) {
71 $command = "cat $nf_conntrack_file";
72 } elsif (-r $ip_conntrack_file ) {
73 $command = "cat $ip_conntrack_file";
75 die "Can't find conntrack information\n";
80 open CMD, "$command|";
82 if (/ESTABLISHED\s+src=(\S+)\s+dst=(\S+)\s+sport.*src=(\S+)\s+dst=(\S+)/) {
92 print "forward.value $forward\n";
93 print "local.value $local\n"