Live Ping graph


The first snippet makes ping queries and saves the response time to pingstat.txt.


ping www.google.com |
grep --line-buffered -Eo "time=[0-9\.]+ ms" |
sed -u 's/time=\([0-9\.]*\) ms/\1/g' |
while read line; do echo $(date +%s)" $line"; done >> pingstat.txt

The second takes the last 200 from them and displays them in a graph (gnuplot).


while true; do
tail -n200 <pingstat.txt >pingstat1.txt;
echo 'plot [] [0:1000] "pingstat1.txt" with lines notitle';
sleep 1;
done } |
gnuplot

  1. No comments yet.
(will not be published)

  1. No trackbacks yet.