Hi,
I am trying to write this munin script to log all the accepted TCP/UDP/ICMP packets that are comming trough my iptable firewall.I then need a bash-script that will collect the packets that are comming trough the firewall.
The IPtable output could briefly looks like this:
Quote:
Chain INPUT:
pktg bytes target prot
3 254 accept tcp
|
What I need is a script that fetches i.e. accepted tcp connections, where the packet state is 1<=. I need a way to "look" at the pktg-colum to determind if the value is at least 1.
This is what i got for now:
Quote:
#!/bin/bash
if [ "$1" = "config" ]; then
echo munin-graph info.......................
echo munin-graph info.......................
echo munin-graph info.......................
exit 0;
fi
echo -n "tcp.value ";iptables -vxL | grep tcp | grep ACCEPT | awk '{print $1}'
echo -n "udp.value ";iptables -vxL | grep udp | grep ACCEPT | awk '{print $1}'
echo -n "icmp.value ";iptables -vxL | grep icmp | grep ACCEPT | awk '{print $1}'
echo -n "total.value ";iptables -vxL | grep ACCEPT | awk '{print $1}'
|