mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 10:28:36 +00:00
32 lines
753 B
Bash
32 lines
753 B
Bash
#!/bin/bash
|
|
#Graph number of members of netfilter ipsets
|
|
#(c) Tomas Mudrunka 2016
|
|
#
|
|
#Add this line to sudoers:
|
|
#ALL ALL = (root) NOPASSWD: /sbin/ipset list [!-]*, /sbin/ipset list -n
|
|
#
|
|
#%# family=auto
|
|
#%# capabilities=autoconf
|
|
|
|
[ "$1" = "autoconf" ] && {
|
|
[ -e /sbin/ipset -o -n "$(which ipset)" ] && echo 'yes' || echo 'no (ipset binary not present)'
|
|
exit 0
|
|
}
|
|
|
|
[ "$1" = "config" ] && {
|
|
echo graph_title Netfilter IPSets
|
|
echo graph_category network
|
|
echo graph_vlabel Members
|
|
echo graph_args --base 1000 --logarithmic --units=si
|
|
}
|
|
|
|
sudo ipset list -n | while read list; do
|
|
[ "$1" = "config" ] && {
|
|
echo "$list.label $list"
|
|
echo "$list.min 0"
|
|
} || {
|
|
echo "$list.value $(( $(sudo ipset list $list | wc -l) - 7 ))"
|
|
}
|
|
done;
|
|
|
|
exit 0
|