From a477dd629e3984e310f77570ea22fb81736193a9 Mon Sep 17 00:00:00 2001 From: Wolf Vogel Date: Sat, 2 Mar 2024 09:07:03 +0100 Subject: [PATCH] Fix pdns_rel to always have correct output Fix the condition to not return any values when there were no queries to the server since the last call. Return a 0 as cache hit rate in that case. --- plugins/pdns/pdns_rel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/pdns/pdns_rel b/plugins/pdns/pdns_rel index b42439d8..28e5a1d2 100755 --- a/plugins/pdns/pdns_rel +++ b/plugins/pdns/pdns_rel @@ -49,6 +49,8 @@ if [ -f "$state_file" ] && [ "$(stat --format=%Y "$state_file")" -gt "$(date --d d_queries=$((queries - old_queries)) if [ $d_queries -gt 0 ] ; then echo packetcache_hitrate.value $(( d_hits * 100 / d_queries )) + else + echo packetcache_hitrate.value 0 fi fi