check_sip_connected_peers: fix division by zero problem
This commit is contained in:
parent
fd9559312e
commit
8253e3e1bc
1 changed files with 6 additions and 2 deletions
|
@ -102,8 +102,12 @@ do
|
|||
fi
|
||||
done
|
||||
debug "Nb connected peers : $nb_connected"
|
||||
let avg_latency=sum_latency/nb_connected
|
||||
debug "Average latency of connected peers : $avg_latency ($sum_latency / $nb_connected)"
|
||||
avg_latency=0
|
||||
if [[ $nb_connected -gt 0 ]]
|
||||
then
|
||||
let avg_latency=sum_latency/nb_connected
|
||||
debug "Average latency of connected peers : $avg_latency ($sum_latency / $nb_connected)"
|
||||
fi
|
||||
|
||||
STATE=OK
|
||||
MSG="$nb_connected peer(s) connected on $SITE_NAME with an average latency of $avg_latency ms|'connected peers':$nb_connected;$WARNING_PEER_NUMBER;$CRITICAL_PEER_NUMBER;0;0 'average latency':$avg_latency;$WARNING_LATENCY;$CRITICAL_LATENCY;0;0"
|
||||
|
|
Loading…
Reference in a new issue