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:
parent
87d30e5597
commit
9aa6d7e977
@ -43,4 +43,4 @@ if [ "$1" = "config" ]; then
|
||||
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'
|
||||
|
@ -55,4 +55,4 @@ if [ "$1" = "config" ]; then
|
||||
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'
|
||||
|
@ -38,18 +38,18 @@ fi
|
||||
|
||||
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)
|
||||
if [ -f "$state_file" ]; then
|
||||
old_hits=$(head -n1 "$state_file")
|
||||
old_queries=$(tail -n1 "$state_file")
|
||||
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 [ -f "$state_file" ] && [ "$(stat --format=%Y "$state_file")" -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 ))
|
||||
echo packetcache_hitrate.value $(( d_hits * 100 / d_queries ))
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $hits > $state_file
|
||||
echo $queries >> $state_file
|
||||
echo "$hits" > "$state_file"
|
||||
echo "$queries" >> "$state_file"
|
||||
|
Loading…
Reference in New Issue
Block a user