Mercurial > ~darius > hgwebdir.cgi > adslstats
changeset 39:1a87c79cf103
Handle new ping which does IPv6 (and spells stddev as std-dev!)
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 04 Jul 2022 13:18:58 +0930 |
parents | 6f85bedf9966 |
children | 947fa4062b01 |
files | speedcheck.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/speedcheck.py Wed Dec 02 11:19:50 2020 +1030 +++ b/speedcheck.py Mon Jul 04 13:18:58 2022 +0930 @@ -80,8 +80,12 @@ if len(l) != 6: print('Unable to parse ping line:', l) xx, xx, xx, plossline, latline, xx = l - ploss = float(re.match('.* received, ([0-9.]+)% packet loss', plossline).groups()[0]) - latency = float(re.match('.*stddev = [0-9.]+/([0-9.]+)/.* ms', latline).groups()[0]) + ploss = re.match('.* received, ([0-9.]+)% packet loss', plossline) + if ploss is not None: + ploss = float(ploss.groups()[0]) + latency = re.match('.*std-?dev = [0-9.]+/([0-9.]+)/.* ms', latline) + if latency is not None: + latency = float(latency.groups()[0]) return ploss, latency def createrrd(rrdname):