zabbix-monitoring/gateway_scripts/route-table42-reachable.sh
2014-12-01 20:46:39 +01:00

15 lines
257 B
Bash
Executable file

#!/bin/sh
TARGET=8.8.8.8
PACKETMARK=1
GATEWAY_IP=#CHANGEME
NUMPROBES=4
THRESHOLD=2
RECEIVED=$(ping -m"$PACKETMARK" -I "$GATEWAY_IP" -c "$NUMPROBES" "$TARGET" | grep -oP '\d+(?= received)')
if [ "$RECEIVED" -ge "$THRESHOLD" ]; then
echo 1
else
echo 0
fi