Skip to content

Instantly share code, notes, and snippets.

@berg
Created May 10, 2012 07:08
Show Gist options
  • Save berg/2651593 to your computer and use it in GitHub Desktop.
Save berg/2651593 to your computer and use it in GitHub Desktop.
Script to poll iptables counters
#!/bin/sh
# iptables counter poller
# released under CC0 (public domain)
while true; do
((date +%s; \
iptables -t mangle -x -L FORWARD -vvv -n \
| tail +3 \
| awk '{print $2}') \
| tr '\n' ' '; echo '') >> /var/tmp/log.txt
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment