diff options
author | Florian Eckert <fe@dev.tdt.de> | 2019-06-28 13:55:29 +0200 |
---|---|---|
committer | Florian Eckert <fe@dev.tdt.de> | 2020-07-20 08:13:34 +0200 |
commit | b0acbf057e05bbfb165fd83a181c0d1607da5558 (patch) | |
tree | 6e196b7e0f8aaa391accf8c6bd9abc2d6dba6dd5 /net/mwan3/files | |
parent | 058a2b6f3057d849cbe4f2c4fda258d32d6da2fd (diff) |
mwan3: add online and uptime to detail output
Add also online time value and uptime time value from netifd to the
detail output view.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'net/mwan3/files')
-rw-r--r-- | net/mwan3/files/lib/mwan3/mwan3.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index 105aafa0c..2ec760f9a 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -1,5 +1,7 @@ #!/bin/sh +. /usr/share/libubox/jshn.sh + IP4="ip -4" IP6="ip -6" IPS="ipset" @@ -1066,7 +1068,18 @@ mwan3_report_iface_status() [ -n "$($IP rule | awk '$1 == "'$(($id+2000)):'"')" ] && \ [ -n "$($IPT -S mwan3_iface_in_$1 2> /dev/null)" ] && \ [ -n "$($IP route list table $id default dev $device 2> /dev/null)" ]; then - result="$(mwan3_get_iface_hotplug_state $1)" + json_init + json_add_string section interfaces + json_add_string interface "$1" + json_load "$(ubus call mwan3 status "$(json_dump)")" + json_select "interfaces" + json_select "$1" + json_get_vars online uptime + json_select .. + json_select .. + online="$(printf '%02dh:%02dm:%02ds\n' $(($online/3600)) $(($online%3600/60)) $(($online%60)))" + uptime="$(printf '%02dh:%02dm:%02ds\n' $(($uptime/3600)) $(($uptime%3600/60)) $(($uptime%60)))" + result="$(mwan3_get_iface_hotplug_state $1) $online, uptime $uptime" elif [ -n "$($IP rule | awk '$1 == "'$(($id+1000)):'"')" ] || \ [ -n "$($IP rule | awk '$1 == "'$(($id+2000)):'"')" ] || \ [ -n "$($IPT -S mwan3_iface_in_$1 2> /dev/null)" ] || \ |