2015-02-19 22:03:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This plugin requires the opkg package perl to be installed.
|
|
|
|
|
2015-12-13 18:03:57 +00:00
|
|
|
# Sky's primary DNS recursor, should be as close as possible to latency from the home to the packet network
|
|
|
|
host="90.207.238.97"
|
|
|
|
timeout=1
|
|
|
|
count=5
|
2015-02-19 22:03:46 +00:00
|
|
|
|
|
|
|
if [ "$1" == "config" ];then
|
|
|
|
echo "multigraph ping_lat
|
2015-12-13 18:03:57 +00:00
|
|
|
graph_title ADSL latency
|
2015-02-19 22:03:46 +00:00
|
|
|
graph_scale no
|
|
|
|
graph_args --base 1000 -l 0
|
|
|
|
graph_vlabel latency (ms)
|
|
|
|
graph_category network
|
2015-12-13 18:03:57 +00:00
|
|
|
graph_info This graph shows connection latency, testing against $host
|
2015-02-19 22:03:46 +00:00
|
|
|
ping.label $host
|
|
|
|
ping.min 0
|
|
|
|
|
|
|
|
multigraph ping_loss
|
2015-12-13 18:03:57 +00:00
|
|
|
graph_title Packet loss
|
2015-02-19 22:03:46 +00:00
|
|
|
graph_scale no
|
|
|
|
graph_args --base 1000 -l 0
|
|
|
|
graph_vlabel loss (%)
|
|
|
|
graph_category wan
|
|
|
|
graph_info This graph shows packet loss encountered when pinging $host
|
|
|
|
loss.label % lost
|
|
|
|
loss.colour COLOUR15"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2015-12-13 18:03:57 +00:00
|
|
|
/bin/ping -c $count -W $timeout $host|/usr/bin/perl -ne '/^round.*=.*?\/([0-9\.]+)\// and print "multigraph ping_lat\nping.value $1\n";/ ([0-9]+)% packet loss/ and print "multigraph ping_loss\nloss.value $1\n"'
|