:
# checkremote - check jitter, packet loss, etc. to remote host
#
# Usage: checkremote [ -q ] { HOSTNAME | IPADDRESS }
#
# Created on: 2009/02/12
#
#####################################################################
#
PCOUNT=100
QOS=
Usage(){
echo
echo "ERROR: Missing remote hostname or IP address"
echo
echo " checkremote [ -q ] { HOSTNAME | IPADDRESS }"
echo
echo " -q Enable QoS 0x10"
echo " HOSTNAME Hostname of remote server"
echo " IPADDRESS IP Address of remote server"
echo
exit 1
}
[ "$1" ] || Usage
[ "$1" = "-q" ] && { QOS=" -Q 0x10"; shift; }
echo
echo " Checking remote host '$1' -- this could take $PCOUNT seconds..."
echo
RESULTS=`ping -q $QOS -c $PCOUNT $1`
[ $? = 0 ] || {
echo
echo "ERROR: Pinging remote host '$1' resulted in an error."
echo
exit 2
}
LOSS=`echo "$RESULTS" | grep loss | cut -d, -f3`
LOSS=`echo $LOSS`
AVG="`echo \"$RESULTS\" | grep ^rtt | cut -d/ -f5` ms"
MDEV=`echo "$RESULTS" | grep ^rtt | cut -d/ -f7 | cut -d, -f1`
echo " Results from checking: $1"
[ "$QOS" ] && echo " QoS ToS: 0x10"
echo " $LOSS"
echo " Average ping time: $AVG"
echo " Packet jitter: $MDEV"
echo
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment