fff-layer3: Add latency to nodewatcher
This patch add the latency to the nodewatcher data. The target of the ping can configure in /etc/config/fff Example: config latency 'latency' option ipv4 'ff1.zbau.f3netze.de' option ipv6 'ff1.zbau.f3netze.de' if no target is set, no latency is send. Signed-off-by: Christian Dresel <freifunk@dresel.systems> Acked-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
a43b37e9f6
commit
2bc21aa63f
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/sh
|
||||||
|
ipv4dest=$(uci -q get fff.latency.ipv4)
|
||||||
|
ipv6dest=$(uci -q get fff.latency.ipv6)
|
||||||
|
if [ -n "$ipv4dest" ] || [ -n "$ipv6dest" ] ; then
|
||||||
|
printf "<latency>"
|
||||||
|
|
||||||
|
if [ -n "$ipv4dest" ] ; then
|
||||||
|
ipv4latency=$(ping -qc3 -4 $ipv4dest 2>&1 | awk -F'/' 'END{ print (/^round-trip/? $4:"0") }')
|
||||||
|
printf "<ipv4latency>$ipv4latency</ipv4latency><ipv4dest>$ipv4dest</ipv4dest>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$ipv6dest" ] ; then
|
||||||
|
ipv6latency=$(ping -qc3 -6 $ipv6dest 2>&1 | awk -F'/' 'END{ print (/^round-trip/? $4:"0") }')
|
||||||
|
printf "<ipv6latency>$ipv6latency</ipv6latency><ipv6dest>$ipv6dest</ipv6dest>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "</latency>"
|
||||||
|
fi
|
||||||
|
exit 0
|
Loading…
Reference in New Issue