Contribution : CSF & Munin
Posted: 21 Aug 2013, 17:10
Hi!
I found for make a graph with fail2ban stats. Works fine [1]
Now, I addapt this for CSF, so, I am sharing with you
1 - Script
Save as you want
We should test if is working
OK.
Install :
Test again:
[1] - http://www.majorxtrem.be/2009/08/14/plu ... our-munin/
----
Edition 1 - 21/08/2013 - 16:56:
When I do the
# echo '[csf]
> user root' >> /etc/munin/plugin-conf.d/munin-node
It's fail because "> user root" is not a valid config :P
Removed ">" char
I found for make a graph with fail2ban stats. Works fine [1]
Now, I addapt this for CSF, so, I am sharing with you
1 - Script
Save as you want
Code: Select all
#!/bin/bash
PROGNAME=csf
STATEDIR=/var/lib/munin/plugin-state
CHAINLIST=$(iptables -L -n |grep Chain|awk {'print $2'})
if [ "$1" = "config" ]
then
echo 'system.type ABSOLUTE'
echo 'graph_title CSF'
echo 'graph_vlabel Number of ban'
echo 'graph_category Security'
for f in $CHAINLIST; do
echo "$f.label $f"
done
exit 0
fi
for f in $CHAINLIST; do
echo "$f.value $(iptables -L $f -n|egrep -v 'Chain|pkts'|wc -l)"
done
Code: Select all
# bash csf_munin
INPUT.value 45
FORWARD.value 2
OUTPUT.value 48
ALLOWIN.value 4
ALLOWOUT.value 4
DENYIN.value 202
DENYOUT.value 202
INVALID.value 12
INVDROP.value 3
LOCALINPUT.value 4
LOCALOUTPUT.value 4
LOGDROPIN.value 24
LOGDROPOUT.value 6
acctboth.value 45
Install :
Code: Select all
# cp csf_munin /usr/share/munin/plugins/csf
# chmod +x /usr/share/munin/plugins/csf
# ln /usr/share/munin/plugins/csf /etc/munin/plugins/csf
# echo '[csf]
user root' >> /etc/munin/plugin-conf.d/munin-node
# service munin-node restart
Stopping Munin Node agents: [ OK ]
Starting Munin Node: [ OK ]
Code: Select all
telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# munin node at vps.lalalala.com
fetch csf
INPUT.value 44
FORWARD.value 1
OUTPUT.value 47
ALLOWIN.value 3
ALLOWOUT.value 3
DENYIN.value 201
DENYOUT.value 201
INVALID.value 11
INVDROP.value 2
LOCALINPUT.value 3
LOCALOUTPUT.value 3
LOGDROPIN.value 23
LOGDROPOUT.value 5
acctboth.value 44
.
quit
Connection closed by foreign host.
[1] - http://www.majorxtrem.be/2009/08/14/plu ... our-munin/
----
Edition 1 - 21/08/2013 - 16:56:
When I do the
# echo '[csf]
> user root' >> /etc/munin/plugin-conf.d/munin-node
It's fail because "> user root" is not a valid config :P
Removed ">" char