Created
November 20, 2020 23:08
-
-
Save johnl/9e7b39f87baa3b240d6a09b1e517007d to your computer and use it in GitHub Desktop.
collectd script to report ipt hashtable sizes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Plugin exec> | |
Exec "nobody" "/usr/local/bin/collectd_ipt_hashtable.sh" | |
</Plugin> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}" | |
INTERVAL="${COLLECTD_INTERVAL:-60}" | |
cd /proc/net | |
while sleep "$INTERVAL"; do | |
wc -l ip{6t,t}_hashlimit/* 2>/dev/null | while read count filename ; do | |
metric="" | |
case "$filename" in | |
total) | |
continue | |
;; | |
ip6*) | |
metric="ipv6-${filename##*/}" | |
;; | |
ipt*) | |
metric="ipv4-${filename##*/}" | |
;; | |
esac | |
echo "PUTVAL \"$HOSTNAME/ipt_hashlimit_count/gauge-$metric\" interval=$INTERVAL N:$count" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment