1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51: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
# only renew stats if older than 4 minutes
if [ "$refresh_minutes" = "" ]; then
refresh_minutes=4
fi
if [ "$(find "$(dirname "$stat_file")" -mindepth 1 -maxdepth 1 -cmin -"$refresh_minutes" -name "$(basename "$stat_file")" )" == "" ] ; then
if [ -e "${stat_file}" ] ; then
# Blank the stats file (else stats are appended not replaced) # Blank the stats file (else stats are appended not replaced)
rm ${stat_file} rm "${stat_file}"
fi
# Ask to bind to build new one # Ask to bind to build new one
${rndc} stats ${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
# only renew stats if older than 4 minutes
if [ "$refresh_minutes" = "" ]; then
refresh_minutes=4
fi
if [ "$(find "$(dirname "$stat_file")" -mindepth 1 -maxdepth 1 -cmin -"$refresh_minutes" -name "$(basename "$stat_file")" )" == "" ] ; then
if [ -e "${stat_file}" ] ; then
# Blank the stats file (else stats are appended not replaced) # Blank the stats file (else stats are appended not replaced)
rm ${stat_file} rm "${stat_file}"
fi
# Ask to bind to build new one # Ask to bind to build new one
${rndc} stats ${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
# only renew stats if older than 4 minutes
if [ "$refresh_minutes" = "" ]; then
refresh_minutes=4
fi
if [ "$(find "$(dirname "$stat_file")" -mindepth 1 -maxdepth 1 -cmin -"$refresh_minutes" -name "$(basename "$stat_file")" )" == "" ] ; then
if [ -e "${stat_file}" ] ; then
# Blank the stats file (else stats are appended not replaced) # Blank the stats file (else stats are appended not replaced)
rm ${stat_file} rm "${stat_file}"
fi
# Ask to bind to build new one # Ask to bind to build new one
${rndc} stats ${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"