projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "interface plugin: Fix for bogus interfaces under Solaris." into collectd-4.10
[collectd.git]
/
src
/
interface.c
diff --git
a/src/interface.c
b/src/interface.c
index
3e5a3d0
..
9aae5ae
100644
(file)
--- 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;
{
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<num>" */
+ 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 (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;
}
continue;
ksp[numif++] = ksp_chain;
}
@@
-235,7
+241,7
@@
static int interface_read (void)
char buffer[1024];
unsigned long long incoming, outgoing;
char *device;
char buffer[1024];
unsigned long long incoming, outgoing;
char *device;
-
+
char *dummy;
char *fields[16];
int numfields;
char *dummy;
char *fields[16];
int numfields;
@@
-261,7
+267,7
@@
static int interface_read (void)
if (device[0] == '\0')
continue;
if (device[0] == '\0')
continue;
-
+
numfields = strsplit (dummy, fields, 16);
if (numfields < 11)
numfields = strsplit (dummy, fields, 16);
if (numfields < 11)