mwan3: rename downtime to offline

Rename downtime ubus output from mwan3 to offline.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert 2019-06-28 12:41:17 +02:00
parent 3be40786f5
commit 6c2cd78c6f
2 changed files with 7 additions and 7 deletions

View file

@ -75,7 +75,7 @@ get_mwan3_status() {
local running="0" local running="0"
local age=0 local age=0
local online=0 local online=0
local downtime=0 local offline=0
local pid device time_p time_n time_u time_d local pid device time_p time_n time_u time_d
network_get_device device $1 network_get_device device $1
@ -98,16 +98,16 @@ get_mwan3_status() {
let online=time_n-time_u let online=time_n-time_u
} }
time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/DOWNTIME")" time_d="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/OFFLINE")"
[ -z "${time_d}" ] || [ "${time_d}" = "0" ] || { [ -z "${time_d}" ] || [ "${time_d}" = "0" ] || {
time_n="$(get_uptime)" time_n="$(get_uptime)"
let downtime=time_n-time_d let offline=time_n-time_d
} }
json_add_object "${iface}" json_add_object "${iface}"
json_add_int age "$age" json_add_int age "$age"
json_add_int online "${online}" json_add_int online "${online}"
json_add_int downtime "${downtime}" json_add_int offline "${offline}"
json_add_int "score" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/SCORE")" json_add_int "score" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/SCORE")"
json_add_int "lost" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOST")" json_add_int "lost" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/LOST")"
json_add_int "turn" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TURN")" json_add_int "turn" "$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TURN")"

View file

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