Hi all,

We've come across a problem when bonding multiple interfaces under
Linux. The reported network information was counted both for the bonding
interface and for the slave interfaces - incorrectly doubling the
network usage stats.


I'm attaching a patch which solves the issue - it supports up to 10
bonding interfaces.

If you want me to open a bugzilla entry, let me know.


Cheers,

Alex

--- metrics.c	2006-04-17 17:42:55.000000000 +0300
+++ /usr/local/src/ganglia-3.0.3.new/srclib/libmetrics/linux/metrics.c	2006-06-22 12:01:16.000000000 +0300
@@ -151,7 +151,7 @@
      while (*p != 0x00 )
        {
        p = index(p, ':')+1; /*  skip past the interface tag portion of this line */
-       if ( (*(p-2) != 'o') && (*(p-3) != 'l') )
+       if ( ((*(p-2) != 'o') && (*(p-3) != 'l')) && ((*(p-3) != 'd') && (*(p-4) != 'n') && (*(p-5) != 'o') &&(*(p-6) != 'b')) )
           {
           t = strtod( p, &p );
           bytes_in += t;
@@ -209,7 +209,7 @@
      while (*p != 0x00 )
        {
        p = index(p, ':')+1; /*  skip past the interface tag portion of this line */
-       if ( (*(p-2) != 'o') && (*(p-3) != 'l') )
+       if ( ((*(p-2) != 'o') && (*(p-3) != 'l')) && ((*(p-3) != 'd') && (*(p-4) != 'n') && (*(p-5) != 'o') &&(*(p-6) != 'b')) )
           {
           t = strtod( p, &p );
           bytes_in += t;
@@ -267,7 +267,7 @@
      while (*p != 0x00 )
        {
        p = index(p, ':')+1; /*  skip past the interface tag portion of this line */
-       if ( (*(p-2) != 'o') && (*(p-3) != 'l') )
+       if ( ((*(p-2) != 'o') && (*(p-3) != 'l')) && ((*(p-3) != 'd') && (*(p-4) != 'n') && (*(p-5) != 'o') &&(*(p-6) != 'b')) )
           {
           t = strtod( p, &p );
           bytes_in += t;
@@ -328,7 +328,7 @@
        {
        p = index(p, ':')+1; /*  skip past the interface tag portion of this line */
        debug_msg(" Last two chars: %c%c\n", *p-2, *p-1 );
-       if ( (*(p-2) != 'o') && (*(p-3) != 'l') )
+       if ( ((*(p-2) != 'o') && (*(p-3) != 'l')) && ((*(p-3) != 'd') && (*(p-4) != 'n') && (*(p-5) != 'o') &&(*(p-6) != 'b')) )
           {
           debug_msg(" Last two chars: %c%c\n", *p-2, *p-1 );
           t = strtod( p, &p );

Reply via email to