nix/pkgs/openwrt: add usteer stats
This commit is contained in:
parent
779cbe9795
commit
10bcbd5d52
|
@ -92,6 +92,7 @@ in rec {
|
||||||
"collectd"
|
"collectd"
|
||||||
"collectd-mod-iwinfo" "collectd-mod-network"
|
"collectd-mod-iwinfo" "collectd-mod-network"
|
||||||
"collectd-mod-interface" "collectd-mod-load" "collectd-mod-cpu"
|
"collectd-mod-interface" "collectd-mod-load" "collectd-mod-cpu"
|
||||||
|
"collectd-mod-exec"
|
||||||
] ++ (
|
] ++ (
|
||||||
if args.variant != "tiny"
|
if args.variant != "tiny"
|
||||||
then [
|
then [
|
||||||
|
@ -117,6 +118,8 @@ in rec {
|
||||||
cat > $out/etc/uci-defaults/99-zentralwerk <<EOF
|
cat > $out/etc/uci-defaults/99-zentralwerk <<EOF
|
||||||
${uciConfig hostName}
|
${uciConfig hostName}
|
||||||
EOF
|
EOF
|
||||||
|
cp ${./usteer-info.sh} $out/usr/sbin/usteer-info.sh
|
||||||
|
cp ${./usteer-stats.sh} $out/usr/bin/usteer-stats.sh
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -367,6 +367,7 @@ in
|
||||||
# the gateways is reachable
|
# the gateways is reachable
|
||||||
cat >/etc/crontabs/root <<__CRON__
|
cat >/etc/crontabs/root <<__CRON__
|
||||||
* * * * * /usr/sbin/wifi-on-link.sh
|
* * * * * /usr/sbin/wifi-on-link.sh
|
||||||
|
* * * * * /usr/sbin/usteer-info.sh
|
||||||
__CRON__
|
__CRON__
|
||||||
cat >/usr/sbin/wifi-on-link.sh <<__SH__
|
cat >/usr/sbin/wifi-on-link.sh <<__SH__
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
@ -413,9 +414,13 @@ in
|
||||||
LoadPlugin interface
|
LoadPlugin interface
|
||||||
LoadPlugin iwinfo
|
LoadPlugin iwinfo
|
||||||
LoadPlugin network
|
LoadPlugin network
|
||||||
|
LoadPlugin exec
|
||||||
<Plugin network>
|
<Plugin network>
|
||||||
Server "${config.site.net.serv.hosts6.dn42.stats}" "25826"
|
Server "${config.site.net.serv.hosts6.dn42.stats}" "25826"
|
||||||
</Plugin>
|
</Plugin>
|
||||||
|
<Plugin exec>
|
||||||
|
Exec "nobody" "/usr/bin/usteer-stats.sh"
|
||||||
|
</Plugin>
|
||||||
COLLECTD
|
COLLECTD
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/sh
|
||||||
|
[ -p /var/run/usteer-info ] || exit 0
|
||||||
|
exec /bin/ubus call usteer local_info > /var/run/usteer-info
|
|
@ -0,0 +1,23 @@
|
||||||
|
#! /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/load\" interval=$INTERVAL N:$LOAD"
|
||||||
|
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/noise\" interval=$INTERVAL N:$NOISE"
|
||||||
|
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/n_assoc\" interval=$INTERVAL N:$N_ASSOC"
|
||||||
|
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/freq\" interval=$INTERVAL N:$FREQ"
|
||||||
|
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/roam_source\" interval=$INTERVAL N:$ROAM_SOURCE"
|
||||||
|
echo "PUTVAL \"$HOSTNAME/exec-usteer_local_info/roam_target\" interval=$INTERVAL N:$ROAM_TARGET"
|
||||||
|
done
|
Loading…
Reference in New Issue