From: Eddy Geez Date: Sat, 3 Sep 2011 13:10:21 +0000 (-0400) Subject: interface plugin: Fix for bogus interfaces under Solaris. X-Git-Tag: collectd-4.10.5~14^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e7a75874a24c1bf19931d5b4b423a0daa7f9be6b;p=collectd.git interface plugin: Fix for bogus interfaces under Solaris. Under newer versions of Solaris, the method for finding network interfaces results in 'collectd' gathering statistics on an interface called 'mac', along with 16 interfaces named 'wrsmd0' through 'wrsmd15' (which are for WCI Remote Shared Memory). The 'mac' interface is especially problematic because it occurs multiple times, which results in warnings from rrdtool about insertions with the same timestamp. Change-Id: I1ae070ecbc820da25c0f0ad457aba80213339fd2 Signed-off-by: Florian Forster --- diff --git a/src/interface.c b/src/interface.c index 1ba6c8c3..9aae5aef 100644 --- a/src/interface.c +++ b/src/interface.c @@ -141,11 +141,17 @@ static int interface_init (void) { if (strncmp (ksp_chain->ks_class, "net", 3)) continue; + /* Ignore kstat entry if not the regular statistic set. This + * avoids problems with "bogus" interfaces, such as + * "wrsmd" */ + if (strncmp (ksp_chain->ks_name, ksp_chain->ks_module, + strlen (ksp_chain->ks_module)) != 0) + continue; if (ksp_chain->ks_type != KSTAT_TYPE_NAMED) continue; if (kstat_read (kc, ksp_chain, NULL) == -1) continue; - if ((val = get_kstat_value (ksp_chain, "obytes")) == -1LL) + if ((val = get_kstat_value (ksp_chain, "ifspeed")) == -1LL) continue; ksp[numif++] = ksp_chain; }