[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] Graphing number of references to iptables chain
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] Graphing number of references to iptables chain
- From: henrik (at) hswn.dk (Henrik Stoerner)
- Date: Wed, 5 Sep 2007 07:58:36 +0200
- References: <46DE4085.5010400 (at) zandahar.net>
- User-agent: Mutt/1.5.13 (2006-08-11)
On Wed, Sep 05, 2007 at 03:37:09PM +1000, Allan wrote:
> Just wondering if anyone has done or has seen a way of being able to
> graph the number of references to an iptables chain ?
> 'iptables -L spammer' returns currently for example
>
> # iptables -L spammer
> Chain spammer (2269 references)
> target prot opt source destination
> LOG all -- anywhere anywhere LOG level
> debug prefix `Spammer: '
> DROP all -- anywhere anywhere
>
>
> Unfortunately I have zero skills when it comes to rrd and the like so
> I'm looking for something similar I can change to suit or for someone to
> be really generous and help me out.
Run a Hobbit client-side script that does:
#!/bin/sh
REFCOUNT=`iptables -L spammer | grep "^Chain spammer" | awk '{print $3}'|cut -c2-`
$BB $BBDISP "status $MACHINE.spammers green `date`
references: $REFCOUNT
"
exit 0
This generates a "spammers" status with the number from the "references"
line in the iptables output. On the Hobbit server you then feed this
through the "ncv" module - see the description in the "Custom graphs"
help page on your Hobbit server or here:
http://www.hswn.dk/hobbit/help/howtograph.html
Regards,
Henrik