Belegte Airtime im Monitoring anzeigen
Aus Freifunk Franken
Diese Seite enthält veraltete Informationen!
Möglicherweise hat der Inhalt aktuell keine Relevanz mehr oder muss aktualisiert werden.
OpenWRT bietet die Möglichkeit die belegte Airtime auszulesen. Mit diesen Script wird die belegte Airtime ans Monitoring als Statustext geschickt. Die belegte Airtime ist dabei ein Durchschnitt aus der letzten Minute (oder je nachdem wie oft der Cron läuft).
Für 2,4GHz Geräte
/etc/busy.sh
#!/bin/sh
iw dev w2mesh survey dump > /tmp/24dump
cat /tmp/24dump | sed '/Survey/,/\[in use\]/d' > /tmp/24reduced
ACT_CUR=$(ACTIVE=$(cat /tmp/24reduced | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")
BUS_CUR=$(BUSY=$(cat /tmp/24reduced | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")
BUS_CUR_OLD2=$(cat /tmp/bus_cur2)
echo $BUS_CUR > /tmp/bus_cur2
let BUS_CUR_NEW=$BUS_CUR_OLD2-$BUS_CUR
ACT_CUR_OLD2=$(cat /tmp/act_cur2)
echo $ACT_CUR > /tmp/act_cur2
let ACT_CUR_NEW=$ACT_CUR_OLD2-$ACT_CUR
let BUSPROZ2=$BUS_CUR_NEW*100/$ACT_CUR_NEW
echo $BUSPROZ2
echo "Airtime $BUSPROZ2 %" > /tmp/status.txt
Datei ausführbar machen:
chmod +x /etc/busy.sh
/usr/lib/micron.d/fff-nodewatcher folgende Zeile hinzufügen (ja ist eklig, man kann auch einen eigenen Cron anlegen...)
*/1 * * * * /etc/busy.sh
micrond neu starten:
/etc/init.d/micrond restart
Für 2,4GHz und 5GHz Komibgeräte
/etc/busy.sh
#!/bin/sh
MESHZWEI=$(iw dev w2mesh station dump | grep Station -c)
MESHFUENF=$(iw dev w5mesh station dump | grep Station -c)
APZWEI=$(iw dev w2ap station dump | grep Station -c)
APFUENF=$(iw dev w5ap station dump | grep Station -c)
iw dev w2mesh survey dump > /tmp/24dump
iw dev w5mesh survey dump > /tmp/5dump
cat /tmp/24dump | sed '/Survey/,/\[in use\]/d' > /24reduced
ACT_CUR=$(ACTIVE=$(cat /tmp/24reduced | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")
BUS_CUR=$(BUSY=$(cat /tmp/24reduced | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")
BUS_CUR_OLD2=$(cat /tmp/bus_cur2)
echo $BUS_CUR > /tmp/bus_cur2
let BUS_CUR_NEW=$BUS_CUR_OLD2-$BUS_CUR
ACT_CUR_OLD2=$(cat /tmp/act_cur2)
echo $ACT_CUR > /tmp/act_cur2
let ACT_CUR_NEW=$ACT_CUR_OLD2-$ACT_CUR
let BUSPROZ2=$BUS_CUR_NEW*100/$ACT_CUR_NEW
echo $BUSPROZ2
cat /tmp/5dump | sed '/Survey/,/\[in use\]/d' > /5reduced
ACT_CUR=$(ACTIVE=$(cat /tmp/5reduced | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")
BUS_CUR=$(BUSY=$(cat /tmp/5reduced | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")
BUS_CUR_OLD5=$(cat /tmp/bus_cur5)
echo $BUS_CUR > /tmp/bus_cur5
let BUS_CUR_NEW=$BUS_CUR_OLD5-$BUS_CUR
ACT_CUR_OLD5=$(cat /tmp/act_cur5)
echo $ACT_CUR > /tmp/act_cur5
let ACT_CUR_NEW=$ACT_CUR_OLD5-$ACT_CUR
let BUSPROZ5=$BUS_CUR_NEW*100/$ACT_CUR_NEW
echo $BUSPROZ5
echo "Mesh2,4GHz: $MESHZWEI ; Mesh5GHz: $MESHFUENF ; AP2,4GHz: $APZWEI ; AP5GHz: $APFUENF ; BUSY2,4GHz: $BUSPROZ2 % ; BUSY5GHz: $BUSPROZ5 %" > /tmp/status.txt
beim Rest so verfahren wie oben, als Zusatzfeature zeigt er auch noch alle Meshverbindungen und Clients in 2,4GHz und 5GHz aufgetrennt an.