FpingLocation=/usr/sbin/fping.sh
The script parses input from Zabbix. Checks for some of arguments are hardcoded (-C3), thus if you change parameters of a simple check in Zabbix web interface it may failure.
#!/bin/bash
# /usr/sbin/fping.sh
#
export PATH=/root/bin:/sbin:/usr/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/default/bin/:/usr/local/bin/:/usr/local/sbin/:
while IFS=$'\n' read -r LINE || [[ -n "$LINE" ]];
do
IP="$LINE";
if [[ "$1" == "-q" && "$2" == "-C3" ]];
then
DEV=`ip route get $IP | cut -d' ' -f3|tr -d '\n'`
# local
if [[ $DEV == "local0" ]];
then
ARPING=`/sbin/arping -I local0 -c 3 $IP 2>&1|grep Unicast`;
if [[ $ARPING == "" ]];
then
echo "$IP : - - -";
else
echo "$IP : 1.10 1.10 1.10";
fi
else
# not local
/usr/sbin/fping -q -C3 $IP 2>&1;
fi
else
# something else
/usr/sbin/fping $1 $2 $3 $4 $IP 2>&1;
fi