2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

shellcheck fixes for pdns-server plugins.

This commit is contained in:
Bas Couwenberg 2017-09-29 09:27:34 +02:00
parent 87d30e5597
commit 9aa6d7e977
3 changed files with 11 additions and 11 deletions

View File

@ -43,4 +43,4 @@ if [ "$1" = "config" ]; then
fi fi
$command | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep corrupt'\|'servfail'\|'timedout | sed 's/-/_/g' $command | sed 's/=\([0-9]\+\),/.value \1\n/g' | egrep "corrupt|servfail|timedout" | sed 's/-/_/g'

View File

@ -55,4 +55,4 @@ if [ "$1" = "config" ]; then
fi fi
$command | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep udp-'\|'recursing'\|'tcp | sed 's/-/_/g' $command | sed 's/=\([0-9]\+\),/.value \1\n/g' | egrep "udp-|recursing|tcp" | sed 's/-/_/g'

View File

@ -38,18 +38,18 @@ fi
hits=$($command packetcache-hit) hits=$($command packetcache-hit)
queries=$($command udp-queries) queries=$($command udp-queries)
if [ -f $state_file ]; then if [ -f "$state_file" ]; then
old_hits=$(cat $state_file | head -n1) old_hits=$(head -n1 "$state_file")
old_queries=$(cat $state_file | tail -n1) old_queries=$(tail -n1 "$state_file")
fi 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" ] && [ "$(stat --format=%Y "$state_file")" -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"
echo $queries >> $state_file echo "$queries" >> "$state_file"