2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

plugin ipset: fix shellcheck issues

This commit is contained in:
Lars Kruse 2018-04-18 04:04:15 +02:00
parent dfc68cb21a
commit 919991eef3

View File

@ -46,25 +46,33 @@ GPLv2
=cut
[ "$1" = "autoconf" ] && {
[ -e /sbin/ipset -o -n "$(which ipset)" ] && echo 'yes' || echo 'no (ipset binary not present)'
exit 0
get_ipset_list() {
ipset list -n
}
[ "$1" = "config" ] && {
if [ "$1" = "autoconf" ]; then
if [ -e /sbin/ipset ] || [ -n "$(which ipset)" ]; then
echo 'yes'
else
echo 'no (ipset binary not present)'
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo graph_title Netfilter IPSets
echo graph_category network
echo graph_vlabel Members
echo graph_args --base 1000 --logarithmic --units=si
}
ipset list -n | while read list; do
[ "$1" = "config" ] && {
get_ipset_list | while read -r list; do
echo "$list.label $list"
echo "$list.min 0"
} || {
echo "$list.value $(( $(ipset list "$list" | wc -l) - 7 ))"
}
done;
done
exit 0
fi
get_ipset_list | while read -r list; do
echo "$list.value $(( $(ipset list "$list" | wc -l) - 7 ))"
done
exit 0