Package: munin-node
Version: 1.4.6-1
Severity: normal

Dear Maintainer,

I rebooted a system that was using kernel 2.6.32 into one running kernel 3.0.0
After that the /usr/share/munin/plugins/bonding_err_ plugin stopped working.
Here is an example of the results returned.

        $ telnet localhost munin
        Trying ::1...
        Connected to localhost.
        Escape character is '^]'.
        # munin node at wwvrt01.nsw.ddihealth.com
        fetch bonding_err_bond0
        if_eth0.value if_eth1.value if_eth2.value if_eth3.value
        .

The code for this plugin contains the following line:

        grep -A 2 "^Slave Interface: ${if}" ${PROCDIR}/${BONDINGIF} | grep 
"Link Failure Count:" | cut -d " " -f 4

The 'grep -A 2' only returns two lines after the matched line.
So for eth0 (which is part of bond0) I get the following results when just 
running the grep:

        $ grep -A 2 "^Slave Interface: eth0" /proc/net/bonding/bond0
        Slave Interface: eth0
        MII Status: up
        Speed: 100 Mbps

Those lines don't contian the 'Link Failure Count:' line that grep looks for in 
the pipeline.
The full set of entries for interfaces that form the bond0 device look as 
follows:

        Slave Interface: eth0
        MII Status: up
        Speed: 100 Mbps
        Duplex: full
        Link Failure Count: 0
        Permanent HW addr: 00:1b:21:71:9a:f0
        Aggregator ID: 4
        Slave queue ID: 0

        Slave Interface: eth1
        MII Status: up
        Speed: 100 Mbps
        Duplex: full
        Link Failure Count: 0
        Permanent HW addr: 00:1b:21:71:9a:f1
        Aggregator ID: 4
        Slave queue ID: 0

        Slave Interface: eth2
        MII Status: up
        Speed: 100 Mbps
        Duplex: full
        Link Failure Count: 0
        Permanent HW addr: 00:1b:21:71:9a:f4
        Aggregator ID: 4
        Slave queue ID: 0

        Slave Interface: eth3
        MII Status: up
        Speed: 100 Mbps
        Duplex: full
        Link Failure Count: 0
        Permanent HW addr: 00:1b:21:71:9a:f5
        Aggregator ID: 4
        Slave queue ID: 0

Instead of 'grep -A 2' it should instead match all the lines from the 'Slave 
Interface:' line up to the next blank line or EOF.
This way it'll work no matter the order of the lines nor how many get added in 
the future.
I have achieved this by using sed instead of grep.
I've replaced:
        grep -A 2 "^Slave Interface: ${if}" ${PROCDIR}/${BONDINGIF} | grep 
"Link Failure Count:" | cut -d " " -f 4
With:
        sed "0,/^Slave Interface: ${if}/d; /^\$/,\$d" ${PROCDIR}/${BONDINGIF} | 
grep "Link Failure Count:" | cut -d " " -f 4

Or in patch form it is as follows:

--- bonding_err_.orig   2011-11-14 12:42:18.332577791 +1100
+++ bonding_err_        2011-11-14 12:44:24.594788291 +1100
@@ -97,7 +97,7 @@
 grep "^Slave Interface:" ${PROCDIR}/${BONDINGIF} | while read a b if; do
   fieldname=$(clean_fieldname "$if")
   echo -n "if_${fieldname}.value "
-  grep -A 2 "^Slave Interface: ${if}" ${PROCDIR}/${BONDINGIF} | grep "Link 
Failure Count:" | cut -d " " -f 4
+  sed "0,/^Slave Interface: ${if}/d; /^\$/,\$d" ${PROCDIR}/${BONDINGIF} | grep 
"Link Failure Count:" | cut -d " " -f 4
 done

After making this change, the results are now returned.

        # telnet localhost munin
        Trying ::1...
        Connected to localhost.
        Escape character is '^]'.
        # munin node at wwvrt01.nsw.ddihealth.com
        fetch bonding_err_bond0
        if_eth0.value 0
        if_eth1.value 0
        if_eth2.value 0
        if_eth3.value 0
        .

Regards,

Jim Barber
----------
DDI Health


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages munin-node depends on:
ii  adduser             3.113
ii  gawk                1:3.1.8+dfsg-0.1
ii  libnet-server-perl  0.99-3
ii  lsb-base            3.2-28
ii  munin-common        1.4.6-1
ii  perl                5.12.4-6
ii  procps              1:3.2.8-11

Versions of packages munin-node recommends:
ii  libnet-snmp-perl  6.0.1-2



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to