Revision e3e85044
Added by Seth Mos about 14 years ago
usr/local/bin/ping_hosts.sh | ||
---|---|---|
13 | 13 |
# Field 5: Script to run once service is restored |
14 | 14 |
# Field 6: Ping time threshold |
15 | 15 |
# Field 7: Wan ping time threshold |
16 |
# Field 8: Address family |
|
16 | 17 |
|
17 | 18 |
# Read in ipsec ping hosts and check the CARP status |
18 | 19 |
if [ -f /var/db/ipsecpinghosts ]; then |
... | ... | |
66 | 67 |
SERVICERESTOREDSCRIPT=`echo $TOPING | cut -d"|" -f5` |
67 | 68 |
THRESHOLD=`echo $TOPING | cut -d"|" -f6` |
68 | 69 |
WANTHRESHOLD=`echo $TOPING | cut -d"|" -f7` |
70 |
AF=`echo $TOPING | cut -d"|" -f8` |
|
71 |
if [ "$AF" == "inet" ]; then |
|
72 |
PINGCMD=ping |
|
73 |
else |
|
74 |
PINGCMD=ping6 |
|
75 |
fi |
|
69 | 76 |
echo Processing $DSTIP |
70 | 77 |
# Look for a service being down |
71 |
ping -c $COUNT -S $SRCIP $DSTIP
|
|
78 |
$PINGCMD -c $COUNT -S $SRCIP $DSTIP
|
|
72 | 79 |
if [ $? -eq 0 ]; then |
73 | 80 |
# Host is up |
74 | 81 |
# Read in previous status |
... | ... | |
97 | 104 |
fi |
98 | 105 |
echo "Checking ping time $DSTIP" |
99 | 106 |
# Look at ping values themselves |
100 |
PINGTIME=`ping -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2`
|
|
107 |
PINGTIME=`$PINGCMD -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2`
|
|
101 | 108 |
echo "Ping returned $?" |
102 | 109 |
echo $PINGTIME > /var/db/pingmsstatus/$DSTIP |
103 | 110 |
if [ "$THRESHOLD" != "" ]; then |
Also available in: Unified diff
Add field 8 for address family