mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51: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
|
#%# family=auto
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
command="/etc/init.d/pdns dump"
|
command="/usr/bin/pdns_control list"
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
if [ -e /usr/bin/pdns_control ]; then
|
||||||
exit 0
|
echo yes
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo no
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
|
|
|
@ -9,11 +9,16 @@
|
||||||
#%# family=auto
|
#%# family=auto
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
command="/etc/init.d/pdns show"
|
command="/usr/bin/pdns_control show"
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
if [ -e /usr/bin/pdns_control ]; then
|
||||||
exit 0
|
echo yes
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo no
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
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
|
#%# family=auto
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
command="/etc/init.d/pdns show"
|
command="/usr/bin/pdns_control show"
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
if [ -e /usr/bin/pdns_control ]; then
|
||||||
exit 0
|
echo yes
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo no
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
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
|
#%# family=auto
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
command="/etc/init.d/pdns dump"
|
command="/usr/bin/pdns_control list"
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
if [ -e /usr/bin/pdns_control ]; then
|
||||||
exit 0
|
echo yes
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo no
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
|
|
|
@ -9,12 +9,17 @@
|
||||||
#%# family=auto
|
#%# family=auto
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
command="/etc/init.d/pdns show"
|
command="/usr/bin/pdns_control show"
|
||||||
state_file=$MUNIN_PLUGSTATE/pdns_rel.state
|
state_file=$MUNIN_PLUGSTATE/pdns_rel.state
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
if [ -e /usr/bin/pdns_control ]; then
|
||||||
exit 0
|
echo yes
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo no
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
|
@ -31,17 +36,19 @@ if [ "$1" = "config" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hits=$($command packetcache-hit | awk -F= '{print $2}')
|
hits=$($command packetcache-hit)
|
||||||
queries=$($command udp-queries | awk -F= '{print $2}')
|
queries=$($command udp-queries)
|
||||||
old_hits=$(cat $state_file | head -n1)
|
if [ -f $state_file ]; then
|
||||||
old_queries=$(cat $state_file | tail -n1)
|
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
|
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_hits=$(($hits - $old_hits))
|
||||||
d_queries=$(($queries - $old_queries))
|
d_queries=$(($queries - $old_queries))
|
||||||
if [ $d_queries -gt 0 ] ; then
|
if [ $d_queries -gt 0 ] ; then
|
||||||
echo packetcache_hitrate.value $(( $d_hits * 100 / $d_queries ))
|
echo packetcache_hitrate.value $(( $d_hits * 100 / $d_queries ))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $hits > $state_file
|
echo $hits > $state_file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue