mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Use pdns_control utility instead of pdns init script.
The init script is not usable on systems using systemd (e.g. Debian stretch).
This commit is contained in:
parent
a8d117a3f0
commit
87d30e5597
5 changed files with 53 additions and 26 deletions
|
@ -9,11 +9,16 @@
|
|||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns dump"
|
||||
command="/usr/bin/pdns_control list"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
if [ -e /usr/bin/pdns_control ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns show"
|
||||
command="/usr/bin/pdns_control show"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
if [ -e /usr/bin/pdns_control ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
@ -31,4 +36,4 @@ fi
|
|||
|
||||
|
||||
|
||||
echo "latency.value $($command latency | awk -F= '{print $2}')"
|
||||
echo "latency.value $($command latency)"
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns show"
|
||||
command="/usr/bin/pdns_control show"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
if [ -e /usr/bin/pdns_control ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
@ -31,5 +36,5 @@ fi
|
|||
|
||||
|
||||
|
||||
echo "qsize.value $($command qsize_q | awk -F= '{print $2}')"
|
||||
echo "qsize.value $($command qsize-q)"
|
||||
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns dump"
|
||||
command="/usr/bin/pdns_control list"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
if [ -e /usr/bin/pdns_control ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
|
|
@ -9,12 +9,17 @@
|
|||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns show"
|
||||
command="/usr/bin/pdns_control show"
|
||||
state_file=$MUNIN_PLUGSTATE/pdns_rel.state
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
if [ -e /usr/bin/pdns_control ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
@ -31,17 +36,19 @@ if [ "$1" = "config" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
hits=$($command packetcache-hit | awk -F= '{print $2}')
|
||||
queries=$($command udp-queries | awk -F= '{print $2}')
|
||||
old_hits=$(cat $state_file | head -n1)
|
||||
old_queries=$(cat $state_file | tail -n1)
|
||||
hits=$($command packetcache-hit)
|
||||
queries=$($command udp-queries)
|
||||
if [ -f $state_file ]; then
|
||||
old_hits=$(cat $state_file | head -n1)
|
||||
old_queries=$(cat $state_file | tail -n1)
|
||||
fi
|
||||
|
||||
if [ -f $state_file ] && [ $(ls -l --time-style=+%s $state_file | awk '{print $6}') -gt $(date --date="7 minutes ago" +%s) ] ; then
|
||||
d_hits=$(($hits - $old_hits))
|
||||
d_queries=$(($queries - $old_queries))
|
||||
if [ $d_queries -gt 0 ] ; then
|
||||
echo packetcache_hitrate.value $(( $d_hits * 100 / $d_queries ))
|
||||
fi
|
||||
d_hits=$(($hits - $old_hits))
|
||||
d_queries=$(($queries - $old_queries))
|
||||
if [ $d_queries -gt 0 ] ; then
|
||||
echo packetcache_hitrate.value $(( $d_hits * 100 / $d_queries ))
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $hits > $state_file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue