mwan3: rename uptime to online

Rename uptime ubus output from mwan3 to online.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
(cherry picked from commit 3be40786f5)
This commit is contained in:
Florian Eckert 2019-06-28 12:39:05 +02:00
parent 2a64b3a440
commit aa05eb448b
2 changed files with 7 additions and 7 deletions

View file

@ -74,7 +74,7 @@ get_mwan3_status() {
local iface_select="${2}"
local running="0"
local age=0
local uptime=0
local online=0
local downtime=0
local pid device time_p time_n time_u time_d
@ -92,10 +92,10 @@ get_mwan3_status() {
let age=time_n-time_p
}
time_u="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/UPTIME")"
time_u="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/ONLINE")"
[ -z "${time_u}" ] || [ "${time_u}" = "0" ] || {
time_n="$(get_uptime)"
let uptime=time_n-time_u
let online=time_n-time_u
}
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/DOWNTIME")"
@ -106,7 +106,7 @@ get_mwan3_status() {
json_add_object "${iface}"
json_add_int age "$age"
json_add_int uptime "${uptime}"
json_add_int online "${online}"
json_add_int downtime "${downtime}"
json_add_int "score" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/SCORE")"
json_add_int "lost" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOST")"

View file

@ -114,13 +114,13 @@ main() {
if [ "$STATUS" = "offline" ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
echo "0" > /var/run/mwan3track/$1/UPTIME
echo "0" > /var/run/mwan3track/$1/ONLINE
echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME
score=0
else
echo "online" > /var/run/mwan3track/$1/STATUS
echo "0" > /var/run/mwan3track/$1/DOWNTIME
echo "$(get_uptime)" > /var/run/mwan3track/$1/UPTIME
echo "$(get_uptime)" > /var/run/mwan3track/$1/ONLINE
env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
fi
while true; do
@ -261,7 +261,7 @@ main() {
if [ "${IFDOWN_EVENT}" -eq 1 ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
echo "$(get_uptime)" > /var/run/mwan3track/$1/DOWNTIME
echo "0" > /var/run/mwan3track/$1/UPTIME
echo "0" > /var/run/mwan3track/$1/ONLINE
$LOG notice "Interface $1 ($2) is offline"
env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
score=0