diff --git a/plugins/pdns/pdns_errors b/plugins/pdns/pdns_errors index 82b0ffcb..589d0c3a 100755 --- a/plugins/pdns/pdns_errors +++ b/plugins/pdns/pdns_errors @@ -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 diff --git a/plugins/pdns/pdns_latency b/plugins/pdns/pdns_latency index 5178dfd6..907785ca 100755 --- a/plugins/pdns/pdns_latency +++ b/plugins/pdns/pdns_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,4 +36,4 @@ fi -echo "latency.value $($command latency | awk -F= '{print $2}')" +echo "latency.value $($command latency)" diff --git a/plugins/pdns/pdns_qsize b/plugins/pdns/pdns_qsize index 5256e8e6..19e1941b 100755 --- a/plugins/pdns/pdns_qsize +++ b/plugins/pdns/pdns_qsize @@ -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)" diff --git a/plugins/pdns/pdns_queries b/plugins/pdns/pdns_queries index 82f85477..87cf44e2 100755 --- a/plugins/pdns/pdns_queries +++ b/plugins/pdns/pdns_queries @@ -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 diff --git a/plugins/pdns/pdns_rel b/plugins/pdns/pdns_rel index eb660507..3eee007d 100755 --- a/plugins/pdns/pdns_rel +++ b/plugins/pdns/pdns_rel @@ -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