pandorafms/pandora_server/util/plugin/packet_loss.sh

25 lines
572 B
Bash
Raw Normal View History

#!/bin/bash
2020-11-27 13:52:35 +01:00
# (c) 2021 Sancho Lerena
# (c) Artica Soluciones Tecnologicas
# Packet loss ICMP measurement remote plugin
# Remote plugin to measure remote packet loss using ping
# It requires root access, because use flood mode to send many pings.
# It's limited to 50 pings and 10 seconds, so it should not be nasty
# for your network :-)
if [ $# -eq 0 ] || [ $# -eq 1 ]
then
echo "Syntax: <max_timeout_insecs> <target_ip>"
exit -1
fi
TIMEOUT=$1
DESTINATION=$2
echo `ping -W $1 -q -f -c 50 $2 | grep -o "[0-9\.]*. packet loss" | grep -o "[0-9.]*"`