network/nix/pkgs/openwrt/usteer-stats.sh

24 lines
1.2 KiB
Bash
Executable File

#! /bin/sh
HOSTNAME=`cat /proc/sys/kernel/hostname`
INTERVAL=60
[ -p /var/run/usteer-info ] || mkfifo /var/run/usteer-info
while true; do
eval $(cat /var/run/usteer-info | jsonfilter \
-e 'LOAD=@["hostapd.wlan2-c3d2"].load' \
-e 'NOISE=@["hostapd.wlan2-c3d2"].noise' \
-e 'N_ASSOC=@["hostapd.wlan2-c3d2"].n_assoc' \
-e 'FREQ=@["hostapd.wlan2-c3d2"].freq' \
-e 'ROAM_SOURCE=@["hostapd.wlan2-c3d2"].roam_events.source' \
-e 'ROAM_TARGET=@["hostapd.wlan2-c3d2"].roam_events.target'
)
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/stations-load\" interval=$INTERVAL N:$LOAD"
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/signal_noise-noise\" interval=$INTERVAL N:$NOISE"
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/stations-n_assoc\" interval=$INTERVAL N:$N_ASSOC"
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/frequency-freq\" interval=$INTERVAL N:$FREQ"
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/transitions-roam_source\" interval=$INTERVAL N:$ROAM_SOURCE"
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/transitions-roam_target\" interval=$INTERVAL N:$ROAM_TARGET"
done