This file is indexed.

/usr/share/munin/plugins/fw_forwarded_local is in munin-plugins-core 2.0.37-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/perl -w

=head1 NAME

fw_forwarded_local - Plugin to monitor network connections.

=head1 CONFIGURATION

This plugin must run with root privileges

=head2 CONFIGURATION EXAMPLE

/etc/munin/plugin-conf.d/global or other file in that dir must contain:

 [fw_*]
  user root

=head1 NOTES

=over

=item * forward: number of connections forwarded

=item * local: number of connections for the host itself

=back

=head1 AUTHORS

2011.09.23: Perl version by Alex Tomlins

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

use strict;
use Munin::Plugin;

my $conntrack = '/usr/sbin/conntrack';
my $nf_conntrack_file = '/proc/net/nf_conntrack';
my $ip_conntrack_file = '/proc/net/ip_conntrack';

if ( defined($ARGV[0]) and $ARGV[0] eq "autoconf" ) {
    if ( -x $conntrack or -r $nf_conntrack_file or -r $ip_conntrack_file) {
        print "yes\n";
    } else {
        print "no\n";
    }
    exit 0;
}

if ( defined($ARGV[0]) and $ARGV[0] eq "config" ) {
    print "graph_title ipconntrack\n";
    print "graph_args -l 0 --base 1000\n";
    print "graph_vlabel established connections\n";
    print "graph_category network\n";
    print "forward.label forward\n";
    print "forward.type GAUGE\n";
    print "local.label local\n";
    print "local.type GAUGE\n";
    exit 0;
}

my $command;
if ( -x $conntrack) {
    $command = "$conntrack -L -o extended 2>/dev/null";
} elsif ( -r $nf_conntrack_file ) {
    $command = "cat $nf_conntrack_file";
} elsif (-r $ip_conntrack_file ) {
    $command = "cat $ip_conntrack_file";
} else {
    die "Can't find conntrack information\n";
}

my $local = 0;
my $forward = 0;
open CMD, "$command|";
while (<CMD>) {
    if (/ESTABLISHED\s+src=(\S+)\s+dst=(\S+)\s+sport.*src=(\S+)\s+dst=(\S+)/) {
        if ($1 eq $4) {
            $local++;
        } else {
            $forward++;
        }
    }
}
close CMD;

print "forward.value $forward\n";
print "local.value $local\n"