Quantcast
Channel: Planet Ubuntu
Viewing all articles
Browse latest Browse all 17727

Anthony Hook: Old, lazy, and buggy latency test

$
0
0

On my Ubuntu laptop at work, I resurrected one of my old, lazy, and buggy method to check latency to some network device. Perhaps it may be useful to someone.

#!/usr/bin/env bash
limit_ms=150
sleep_duration=1
while [ true ]; do
pong_res=$(ping -c 1 10.0.0.30 | sed -n 's/.*time=\([0-9]*\).*/\1/p')
echo "$(date +%s): pong response is $pong_res"
if [ "$pong_res" -gt "$limit_ms" ]; then
/usr/bin/notify-send -u critical -t 30000 "Ping Alert" "Above Threshhold: $pong_res";
fi
sleep "$sleep_duration"
done

Viewing all articles
Browse latest Browse all 17727

Latest Images

Trending Articles



Latest Images