Modify

Opened 8 years ago

Last modified 4 years ago

#7507 accepted defect

muninlite does not report pppoe-wan and br-lan statistics

Reported by: akhayyat@… Owned by: cshore
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: munin, if_ Cc:

Description

In the munin-node shell script, the following for loop defines a function per network interfac (a similar block exists for fetch_if_err_${INTER}() functions):

for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\)[0-9]\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
do
  RES="$RES if_$INTER"
  eval "fetch_if_${INTER}() { fetch_if $INTER $@; };"
  eval "config_if_${INTER}() { config_if $INTER $@; };"
done

Problem 1: pppoe-wan and br-lan interfaces are not included. To include them, replace the for loop (first line) with:

for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|pppoe-wan\|br-lan\)[0-9]\{0,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');

Problem 2: as INTER is used as a part of a new function name in the subsequent lines in the loop body, the dash in the pppoe-wan and br-lan interfaces cause a problem when using busybox' sh:

-ash: eval: line 1: syntax error: bad function name

Installing bash and replacing #!/bin/sh with #!/bin/bash in the first line of the munin-node script works, but may not be ideal.

PS: to generate a list of all interfaces, use:

cat /proc/net/dev | tail -n +3 | cut -f1 -d: | sed 's/ //g'

Attachments (3)

0001-translate-hyphens-to-underscores.patch (3.6 KB) - added by russell.sim@… 7 years ago.
0002-send-stderr-to-dev-null.patch (764 bytes) - added by russell.sim@… 7 years ago.
0003-add-support-for-br-devices.patch (1.3 KB) - added by russell.sim@… 7 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by jow

  • Owner changed from developers to jow
  • Status changed from new to accepted

comment:2 Changed 7 years ago by jow

  • Milestone changed from Backfire 10.03.1 to Attitude Adjustment (trunk)
  • Version changed from Backfire 10.03 to Trunk

Changed 7 years ago by russell.sim@…

Changed 7 years ago by russell.sim@…

Changed 7 years ago by russell.sim@…

comment:3 Changed 7 years ago by cshore

  • Owner changed from jow to cshore

comment:4 Changed 6 years ago by anonymous

Interfaces are generated correctly (with sed s/-/_/g)
But in the fetch_if and fetch_if_err functions this isn't reset (sed s/_/-/g)

My quick and dirty fixes:

fetch_if() {               
  IIF=$(echo $1 | sed s/\_/-/g)
  IINFO=$(grep "$IIF:" /proc/net/dev | cut -d: -f2 | sed -e 's/  / /g')
  echo "down.value" $(echo $IINFO | cut -d\  -f1)
  echo "up.value" $(echo $IINFO | cut -d\  -f9)
}   

[...]

fetch_if_err() {                      
  IIF=$(echo $1 | sed s/\_/-/g)      
  IINFO=$(grep "$IIF:" /proc/net/dev | cut -d: -f2 | sed -e 's/  / /g')
  echo "rcvd.value" $(echo $IINFO | cut -d\  -f3)                      
  echo "trans.value" $(echo $IINFO | cut -d\  -f11)                         
} 

comment:5 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as accepted .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.