[PATCH] nodewatcher: Provide data about traffic control

Tim Niemeyer tim at tn-x.org
Sa Mär 3 18:58:56 CET 2018


Moin

Am Samstag, den 10.02.2018, 16:33 +0100 schrieb Adrian Schmutzler:
> With this data, the Monitoring can show whether traffic control is
> enabled and which rates are set.
> 
> > Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> 
> > Tested-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  src/packages/fff/fff-nodewatcher/Makefile          |  2 +-
>  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 22 +++++++++++++++++++++-
>  2 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
> index 11a0cb6..9d9cb28 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:=47
> +PKG_VERSION:=48
>  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 3b60500..c73415a 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="47"
> +SCRIPT_VERSION="48"
>  
>  test -f /tmp/started || exit
>  
> @@ -280,6 +280,25 @@ crawl() {
>          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
> +	
Diese Zeile enthält unnütze Tabs.

> +	# simple-tc information
> +	. /lib/functions.sh
Mir würde es besser gefallen, wenn das Laden des Scriptes irgendwo am
Anfang wäre.

> +	config_load simple-tc
> > +	tc_enabled="0"
> > +	tc_in="0"
> > +	tc_out="0"
> > +	parseTcInterface() {
> > +		local iface="$1"
> +		
Diese Zeile enthält unnütze Tabs.

> +		config_get ifname "$iface" ifname
> +		[ "wan" = "$ifname" ] || return
Wenn hier eh alles was nicht "wan" ist, weg geworfen wird, dann sollte
man mMn nicht mit config_foreach arbeiten sondern das Interface direkt
ansprechen.

> +
> > +		config_get tc_enabled "$iface" enabled "0"
> > +		config_get tc_in "$iface" limit_ingress "0"
> > +		config_get tc_out "$iface" limit_egress "0"
> > +	}
> > +	config_foreach parseTcInterface 'interface'
> +    traffic_control="<traffic_control><wan><enabled>$tc_enabled</enabled><in>$tc_in</in><out>$tc_out</out></wan></traffic_control>"
Die Einrückungen sind kaputt. Die Datei nutzt Spaces und keine Tabs.
Bitte einheitlich lassen.

Tim

>  
>      err "$(date): Putting all information into a XML-File and save it at $SCRIPT_DATA_FILE"
>  
> @@ -293,6 +312,7 @@ crawl() {
>      DATA=$DATA"<client_count>$client_count</client_count>"
>      DATA=$DATA"<clients>$dataclient</clients>"
>      DATA=$DATA"$dataair"
> +    DATA=$DATA"$traffic_control"
>      DATA=$DATA"</data>"
>  
>      #write data to xml file that provides the data on httpd
> -- 
> 2.7.4
> 
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 488 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20180303/c295f5fb/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev