[v2] nodewatcher: Provide data to calculate airtime

Submitted by Adrian Schmutzler on Jan. 21, 2018, 7:47 p.m.

Details

Message ID 1516564068-4362-1-git-send-email-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler Jan. 21, 2018, 7:47 p.m.
The actual calculation is done in the Monitoring.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

---

Changes in v2:
- Use wXap instead of wXmesh
---
 src/packages/fff/fff-nodewatcher/Makefile               |  2 +-
 .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher      | 17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
index 273916b..633ec71 100644
--- a/src/packages/fff/fff-nodewatcher/Makefile
+++ b/src/packages/fff/fff-nodewatcher/Makefile
@@ -1,7 +1,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-nodewatcher
-PKG_VERSION:=46
+PKG_VERSION:=47
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
index 195aea5..3b60500 100755
--- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
+++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
@@ -2,7 +2,7 @@ 
 # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
 # License; GPL v3
 
-SCRIPT_VERSION="46"
+SCRIPT_VERSION="47"
 
 test -f /tmp/started || exit
 
@@ -267,6 +267,20 @@  crawl() {
         dataclient="$dataclient<$clientif>$cc</$clientif>"
     done
 
+    dataair=""
+    w2dump="$(iw dev w2ap survey dump 2> /dev/null | sed '/Survey/,/\[in use\]/d')"
+    if [ -n "$w2dump" ] ; then
+        w2_ACT="$(ACTIVE=$(echo "$w2dump" | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
+        w2_BUS="$(BUSY=$(echo "$w2dump" | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
+        dataair="$dataair<airtime2><active>$w2_ACT</active><busy>$w2_BUS</busy></airtime2>"
+    fi
+    w5dump="$(iw dev w5ap survey dump 2> /dev/null | sed '/Survey/,/\[in use\]/d')"
+    if [ -n "$w5dump" ] ; then
+        w5_ACT="$(ACTIVE=$(echo "$w5dump" | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
+        w5_BUS="$(BUSY=$(echo "$w5dump" | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
+        dataair="$dataair<airtime5><active>$w5_ACT</active><busy>$w5_BUS</busy></airtime5>"
+    fi
+
     err "$(date): Putting all information into a XML-File and save it at $SCRIPT_DATA_FILE"
 
     DATA="<?xml version='1.0' standalone='yes'?><data>"
@@ -278,6 +292,7 @@  crawl() {
     DATA=$DATA"<batman_adv_gateway_list>$batman_adv_gateway_list</batman_adv_gateway_list>"
     DATA=$DATA"<client_count>$client_count</client_count>"
     DATA=$DATA"<clients>$dataclient</clients>"
+    DATA=$DATA"$dataair"
     DATA=$DATA"</data>"
 
     #write data to xml file that provides the data on httpd

Comments

Christian Dresel Jan. 21, 2018, 7:49 p.m.
hi

danke für die Arbeit

Tested-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>

wenn jemand ne Möglichkeit findet das nicht von dem Interface (wXap)
sondern direkt vom phy zu lesen, sollten wir das mal ändern ich hab aber
nix gefunden.

mfg

Christian

On 21.01.2018 20:47, Adrian Schmutzler wrote:
> The actual calculation is done in the Monitoring.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> ---
> 
> Changes in v2:
> - Use wXap instead of wXmesh
> ---
>  src/packages/fff/fff-nodewatcher/Makefile               |  2 +-
>  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher      | 17 ++++++++++++++++-
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
> index 273916b..633ec71 100644
> --- a/src/packages/fff/fff-nodewatcher/Makefile
> +++ b/src/packages/fff/fff-nodewatcher/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-nodewatcher
> -PKG_VERSION:=46
> +PKG_VERSION:=47
>  PKG_RELEASE:=1
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> index 195aea5..3b60500 100755
> --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> @@ -2,7 +2,7 @@
>  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
>  # License; GPL v3
>  
> -SCRIPT_VERSION="46"
> +SCRIPT_VERSION="47"
>  
>  test -f /tmp/started || exit
>  
> @@ -267,6 +267,20 @@ crawl() {
>          dataclient="$dataclient<$clientif>$cc</$clientif>"
>      done
>  
> +    dataair=""
> +    w2dump="$(iw dev w2ap survey dump 2> /dev/null | sed '/Survey/,/\[in use\]/d')"
> +    if [ -n "$w2dump" ] ; then
> +        w2_ACT="$(ACTIVE=$(echo "$w2dump" | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
> +        w2_BUS="$(BUSY=$(echo "$w2dump" | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
> +        dataair="$dataair<airtime2><active>$w2_ACT</active><busy>$w2_BUS</busy></airtime2>"
> +    fi
> +    w5dump="$(iw dev w5ap survey dump 2> /dev/null | sed '/Survey/,/\[in use\]/d')"
> +    if [ -n "$w5dump" ] ; then
> +        w5_ACT="$(ACTIVE=$(echo "$w5dump" | grep "active time:"); set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
> +        w5_BUS="$(BUSY=$(echo "$w5dump" | grep "busy time:"); set ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
> +        dataair="$dataair<airtime5><active>$w5_ACT</active><busy>$w5_BUS</busy></airtime5>"
> +    fi
> +
>      err "$(date): Putting all information into a XML-File and save it at $SCRIPT_DATA_FILE"
>  
>      DATA="<?xml version='1.0' standalone='yes'?><data>"
> @@ -278,6 +292,7 @@ crawl() {
>      DATA=$DATA"<batman_adv_gateway_list>$batman_adv_gateway_list</batman_adv_gateway_list>"
>      DATA=$DATA"<client_count>$client_count</client_count>"
>      DATA=$DATA"<clients>$dataclient</clients>"
> +    DATA=$DATA"$dataair"
>      DATA=$DATA"</data>"
>  
>      #write data to xml file that provides the data on httpd
>
Tim Niemeyer Jan. 22, 2018, 7:23 a.m.
Hi

Zeigt halt die airtime nur wenn der AP an ist, aber da der Fehlerfall behandelt ist, OK.

Reviewed-by: Tim Niemeyer <tim@tn-x.org>

Tim

Am 21. Januar 2018 20:49:28 MEZ schrieb Christian Dresel <fff@chrisi01.de>:
>hi
>
>danke für die Arbeit
>
>Tested-by: Christian Dresel <fff@chrisi01.de>
>Reviewed-by: Christian Dresel <fff@chrisi01.de>
>
>wenn jemand ne Möglichkeit findet das nicht von dem Interface (wXap)
>sondern direkt vom phy zu lesen, sollten wir das mal ändern ich hab
>aber
>nix gefunden.
>
>mfg
>
>Christian
>
>On 21.01.2018 20:47, Adrian Schmutzler wrote:
>> The actual calculation is done in the Monitoring.
>> 
>> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>> 
>> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>> 
>> ---
>> 
>> Changes in v2:
>> - Use wXap instead of wXmesh
>> ---
>>  src/packages/fff/fff-nodewatcher/Makefile               |  2 +-
>>  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher      | 17
>++++++++++++++++-
>>  2 files changed, 17 insertions(+), 2 deletions(-)
>> 
>> diff --git a/src/packages/fff/fff-nodewatcher/Makefile
>b/src/packages/fff/fff-nodewatcher/Makefile
>> index 273916b..633ec71 100644
>> --- a/src/packages/fff/fff-nodewatcher/Makefile
>> +++ b/src/packages/fff/fff-nodewatcher/Makefile
>> @@ -1,7 +1,7 @@
>>  include $(TOPDIR)/rules.mk
>>  
>>  PKG_NAME:=fff-nodewatcher
>> -PKG_VERSION:=46
>> +PKG_VERSION:=47
>>  PKG_RELEASE:=1
>>  
>>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>> diff --git
>a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>> index 195aea5..3b60500 100755
>> --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>> +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>> @@ -2,7 +2,7 @@
>>  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
>>  # License; GPL v3
>>  
>> -SCRIPT_VERSION="46"
>> +SCRIPT_VERSION="47"
>>  
>>  test -f /tmp/started || exit
>>  
>> @@ -267,6 +267,20 @@ crawl() {
>>          dataclient="$dataclient<$clientif>$cc</$clientif>"
>>      done
>>  
>> +    dataair=""
>> +    w2dump="$(iw dev w2ap survey dump 2> /dev/null | sed
>'/Survey/,/\[in use\]/d')"
>> +    if [ -n "$w2dump" ] ; then
>> +        w2_ACT="$(ACTIVE=$(echo "$w2dump" | grep "active time:");
>set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
>> +        w2_BUS="$(BUSY=$(echo "$w2dump" | grep "busy time:"); set
>${BUSY:-0 0 0 0 0}; echo -e "${4}")"
>> +       
>dataair="$dataair<airtime2><active>$w2_ACT</active><busy>$w2_BUS</busy></airtime2>"
>> +    fi
>> +    w5dump="$(iw dev w5ap survey dump 2> /dev/null | sed
>'/Survey/,/\[in use\]/d')"
>> +    if [ -n "$w5dump" ] ; then
>> +        w5_ACT="$(ACTIVE=$(echo "$w5dump" | grep "active time:");
>set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
>> +        w5_BUS="$(BUSY=$(echo "$w5dump" | grep "busy time:"); set
>${BUSY:-0 0 0 0 0}; echo -e "${4}")"
>> +       
>dataair="$dataair<airtime5><active>$w5_ACT</active><busy>$w5_BUS</busy></airtime5>"
>> +    fi
>> +
>>      err "$(date): Putting all information into a XML-File and save
>it at $SCRIPT_DATA_FILE"
>>  
>>      DATA="<?xml version='1.0' standalone='yes'?><data>"
>> @@ -278,6 +292,7 @@ crawl() {
>>     
>DATA=$DATA"<batman_adv_gateway_list>$batman_adv_gateway_list</batman_adv_gateway_list>"
>>      DATA=$DATA"<client_count>$client_count</client_count>"
>>      DATA=$DATA"<clients>$dataclient</clients>"
>> +    DATA=$DATA"$dataair"
>>      DATA=$DATA"</data>"
>>  
>>      #write data to xml file that provides the data on httpd
>>
Fabian Blaese Jan. 22, 2018, 11:08 a.m.
Hallo zusammen,

ich fände es noch etwas hübscher, wenn es egal ist, welches dev man aus macht.
Theoretisch wäre es möglich, dass aus dem phy zu nehmen (/sys/class/ieee80211/phy0/device/net), dann weiß man aber widerrum das Band nicht.

Für den Moment könnte ich auch damit leben, wie es aktuell im Patch ist oder mit einer Lösung, die z.B. für 5Ghz alle devices mit w5* durchprobiert.

Ansonsten sieht das soweit gut aus,
Reviewed-by: Fabian Bläse <fabian@blaese.de>

Fabian
Adrian Schmutzler Jan. 22, 2018, 11:15 a.m.
Hallo Fabian,

prinzipiell gebe ich dir Recht.

Ich habe auch schon überlegt, einfach sowas zu machen (Pseudo-Code):

If iwconfig | grep "w2ap"
	w2dev="w2ap"
elif iwconfig | grep "w2mesh"
	w2dev="w2mesh"

Und dann w2dev verwenden... Hier könnte man auch w2sta mit reinnehmen, allerdings finde ich, dass man beim w2sta keine airtime braucht.

Und zu viel if bla Zeugs will ich im nodewatcher auch nicht machen.

Deshalb erstmal so, damit es geht, und dann kann man verfeinern.

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Fabian Bläse
> Sent: Montag, 22. Januar 2018 12:09
> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-
> dev@freifunk.net
> Subject: Re: [PATCH v2] nodewatcher: Provide data to calculate airtime
> 
> Hallo zusammen,
> 
> ich fände es noch etwas hübscher, wenn es egal ist, welches dev man aus
> macht.
> Theoretisch wäre es möglich, dass aus dem phy zu nehmen
> (/sys/class/ieee80211/phy0/device/net), dann weiß man aber widerrum das
> Band nicht.
> 
> Für den Moment könnte ich auch damit leben, wie es aktuell im Patch ist
> oder mit einer Lösung, die z.B. für 5Ghz alle devices mit w5* durchprobiert.
> 
> Ansonsten sieht das soweit gut aus,
> Reviewed-by: Fabian Bläse <fabian@blaese.de>
> 
> Fabian
Tim Niemeyer Jan. 28, 2018, 11:36 a.m.
Hi

Und applied.

Tim

Am Sonntag, den 21.01.2018, 20:47 +0100 schrieb Adrian Schmutzler:
> The actual calculation is done in the Monitoring.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> ---
> 
> Changes in v2:
> - Use wXap instead of wXmesh
> ---
>  src/packages/fff/fff-nodewatcher/Makefile               |  2 +-
>  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher      | 17
> ++++++++++++++++-
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/src/packages/fff/fff-nodewatcher/Makefile
> b/src/packages/fff/fff-nodewatcher/Makefile
> index 273916b..633ec71 100644
> --- a/src/packages/fff/fff-nodewatcher/Makefile
> +++ b/src/packages/fff/fff-nodewatcher/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-nodewatcher
> -PKG_VERSION:=46
> +PKG_VERSION:=47
>  PKG_RELEASE:=1
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> diff --git a/src/packages/fff/fff-
> nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-
> nodewatcher/files/usr/sbin/nodewatcher
> index 195aea5..3b60500 100755
> --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> @@ -2,7 +2,7 @@
>  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
>  # License; GPL v3
>  
> -SCRIPT_VERSION="46"
> +SCRIPT_VERSION="47"
>  
>  test -f /tmp/started || exit
>  
> @@ -267,6 +267,20 @@ crawl() {
>          dataclient="$dataclient<$clientif>$cc</$clientif>"
>      done
>  
> +    dataair=""
> +    w2dump="$(iw dev w2ap survey dump 2> /dev/null | sed
> '/Survey/,/\[in use\]/d')"
> +    if [ -n "$w2dump" ] ; then
> +        w2_ACT="$(ACTIVE=$(echo "$w2dump" | grep "active time:");
> set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
> +        w2_BUS="$(BUSY=$(echo "$w2dump" | grep "busy time:"); set
> ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
> +        dataair="$dataair<airtime2><active>$w2_ACT</active><busy>$w2
> _BUS</busy></airtime2>"
> +    fi
> +    w5dump="$(iw dev w5ap survey dump 2> /dev/null | sed
> '/Survey/,/\[in use\]/d')"
> +    if [ -n "$w5dump" ] ; then
> +        w5_ACT="$(ACTIVE=$(echo "$w5dump" | grep "active time:");
> set ${ACTIVE:-0 0 0 0 0}; echo -e "${4}")"
> +        w5_BUS="$(BUSY=$(echo "$w5dump" | grep "busy time:"); set
> ${BUSY:-0 0 0 0 0}; echo -e "${4}")"
> +        dataair="$dataair<airtime5><active>$w5_ACT</active><busy>$w5
> _BUS</busy></airtime5>"
> +    fi
> +
>      err "$(date): Putting all information into a XML-File and save
> it at $SCRIPT_DATA_FILE"
>  
>      DATA="<?xml version='1.0' standalone='yes'?><data>"
> @@ -278,6 +292,7 @@ crawl() {
>      DATA=$DATA"<batman_adv_gateway_list>$batman_adv_gateway_list</ba
> tman_adv_gateway_list>"
>      DATA=$DATA"<client_count>$client_count</client_count>"
>      DATA=$DATA"<clients>$dataclient</clients>"
> +    DATA=$DATA"$dataair"
>      DATA=$DATA"</data>"
>  
>      #write data to xml file that provides the data on httpd
> -- 
> 2.7.4
>