From: Florian Forster Date: Thu, 24 Nov 2011 14:43:21 +0000 (+0100) Subject: Merge "interface plugin: Fix for bogus interfaces under Solaris." into collectd-4.10 X-Git-Tag: collectd-4.10.5~14 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=83d47bfa3295f837c3fa3fa3e31855a236d43530;hp=7b2265a744ca9a3c7c042748b542deae1b6b39c6;p=collectd.git Merge "interface plugin: Fix for bogus interfaces under Solaris." into collectd-4.10 --- 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; }