1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

bind9_*: update stat_file only if it's older than 4 minutes

This commit is contained in:
Andreas Perhab 2024-12-04 16:13:30 +01:00
parent 8fa02efe0a
commit eb6ce54e07
3 changed files with 39 additions and 12 deletions

View file

@ -26,11 +26,20 @@ if [ "$rndc" = "" ]; then
rndc="/usr/sbin/rndc" rndc="/usr/sbin/rndc"
fi fi
# Blank the stats file (else stats are appended not replaced) # only renew stats if older than 4 minutes
rm ${stat_file} if [ "$refresh_minutes" = "" ]; then
refresh_minutes=4
fi
# Ask to bind to build new one if [ "$(find "$(dirname "$stat_file")" -mindepth 1 -maxdepth 1 -cmin -"$refresh_minutes" -name "$(basename "$stat_file")" )" == "" ] ; then
${rndc} stats if [ -e "${stat_file}" ] ; then
# Blank the stats file (else stats are appended not replaced)
rm "${stat_file}"
fi
# Ask to bind to build new one
${rndc} stats
fi
# The section we are looking for in the stats. # The section we are looking for in the stats.
section="Resolver Statistics" section="Resolver Statistics"

View file

@ -26,11 +26,20 @@ if [ "$rndc" = "" ]; then
rndc="/usr/sbin/rndc" rndc="/usr/sbin/rndc"
fi fi
# Blank the stats file (else stats are appended not replaced) # only renew stats if older than 4 minutes
rm ${stat_file} if [ "$refresh_minutes" = "" ]; then
refresh_minutes=4
fi
# Ask to bind to build new one if [ "$(find "$(dirname "$stat_file")" -mindepth 1 -maxdepth 1 -cmin -"$refresh_minutes" -name "$(basename "$stat_file")" )" == "" ] ; then
${rndc} stats if [ -e "${stat_file}" ] ; then
# Blank the stats file (else stats are appended not replaced)
rm "${stat_file}"
fi
# Ask to bind to build new one
${rndc} stats
fi
# The section we are looking for in the stats. # The section we are looking for in the stats.
section="Name Server Statistics" section="Name Server Statistics"

View file

@ -26,11 +26,20 @@ if [ "$rndc" = "" ]; then
rndc="/usr/sbin/rndc" rndc="/usr/sbin/rndc"
fi fi
# Blank the stats file (else stats are appended not replaced) # only renew stats if older than 4 minutes
rm ${stat_file} if [ "$refresh_minutes" = "" ]; then
refresh_minutes=4
fi
# Ask to bind to build new one if [ "$(find "$(dirname "$stat_file")" -mindepth 1 -maxdepth 1 -cmin -"$refresh_minutes" -name "$(basename "$stat_file")" )" == "" ] ; then
${rndc} stats if [ -e "${stat_file}" ] ; then
# Blank the stats file (else stats are appended not replaced)
rm "${stat_file}"
fi
# Ask to bind to build new one
${rndc} stats
fi
# The section we are looking for in the stats. # The section we are looking for in the stats.
section="Socket I/O Statistics" section="Socket I/O Statistics"