Révision 919991ee
plugin ipset: fix shellcheck issues
| plugins/network/ipset | ||
|---|---|---|
| 46 | 46 |
=cut |
| 47 | 47 |
|
| 48 | 48 |
|
| 49 |
[ "$1" = "autoconf" ] && {
|
|
| 50 |
[ -e /sbin/ipset -o -n "$(which ipset)" ] && echo 'yes' || echo 'no (ipset binary not present)' |
|
| 51 |
exit 0 |
|
| 49 |
get_ipset_list() {
|
|
| 50 |
ipset list -n |
|
| 52 | 51 |
} |
| 53 | 52 |
|
| 54 |
[ "$1" = "config" ] && {
|
|
| 53 |
|
|
| 54 |
if [ "$1" = "autoconf" ]; then |
|
| 55 |
if [ -e /sbin/ipset ] || [ -n "$(which ipset)" ]; then |
|
| 56 |
echo 'yes' |
|
| 57 |
else |
|
| 58 |
echo 'no (ipset binary not present)' |
|
| 59 |
fi |
|
| 60 |
exit 0 |
|
| 61 |
fi |
|
| 62 |
|
|
| 63 |
if [ "$1" = "config" ]; then |
|
| 55 | 64 |
echo graph_title Netfilter IPSets |
| 56 | 65 |
echo graph_category network |
| 57 | 66 |
echo graph_vlabel Members |
| 58 | 67 |
echo graph_args --base 1000 --logarithmic --units=si |
| 59 |
} |
|
| 60 |
|
|
| 61 |
ipset list -n | while read list; do |
|
| 62 |
[ "$1" = "config" ] && {
|
|
| 68 |
get_ipset_list | while read -r list; do |
|
| 63 | 69 |
echo "$list.label $list" |
| 64 | 70 |
echo "$list.min 0" |
| 65 |
} || {
|
|
| 66 |
echo "$list.value $(( $(ipset list "$list" | wc -l) - 7 ))" |
|
| 67 |
} |
|
| 68 |
done; |
|
| 71 |
done |
|
| 72 |
exit 0 |
|
| 73 |
fi |
|
| 69 | 74 |
|
| 75 |
get_ipset_list | while read -r list; do |
|
| 76 |
echo "$list.value $(( $(ipset list "$list" | wc -l) - 7 ))" |
|
| 77 |
done |
|
| 70 | 78 |
exit 0 |
Formats disponibles : Unified diff