#!/usr/bin/perl -w use strict; use warnings; =head1 NAME fw_packets - Plugin to monitor the throuhgput of a firewall =head1 CONFIGURATION This plugin must run with root privileges =head1 CONFIGURATION EXAMPLE /etc/munin/plugin-conf.d/global or other file in that dir must contain: [fw*] user root =head1 AUTHOR Unknown author =head1 LICENSE GPLv2 =head1 MAGIC MARKERS #%# family=auto #%# capabilities=autoconf =cut if ( $ARGV[0] ) { if ( $ARGV[0] eq 'autoconf' ) { if ( -r '/proc/net/snmp') { print "yes\n"; exit 0; } print "no (file /proc/net/snmp not readable)\n"; exit 0; } elsif ( $ARGV[0] eq 'config' ) { print <) { if (/^Ip: \d/) { my @ip = split; my $forwarded = $ip[6]; #forwarded my $received = $ip[3]; #received print "received.value $received\n"; print "forwarded.value $forwarded\n"; # This calculation is invalid, the packet may have been # destined for the firewall, then the difference is wrong. If # you firewall does not receive traffic itself it is correct # though. # # print "rejected.value ", $received - $forwarded,"\n"; last; } } close(F);