projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.4' into collectd-5.5
[collectd.git]
/
src
/
interface.c
diff --git
a/src/interface.c
b/src/interface.c
index
9501161
..
df8ffb4
100644
(file)
--- a/
src/interface.c
+++ b/
src/interface.c
@@
-17,7
+17,7
@@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at
verplant
.org>
+ * Florian octo Forster <octo at
collectd
.org>
* Sune Marcher <sm at flork.dk>
* Manuel Sanmartin
**/
* Sune Marcher <sm at flork.dk>
* Manuel Sanmartin
**/
@@
-141,17
+141,11
@@
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, "
ifspeed
")) == -1LL)
+ if ((val = get_kstat_value (ksp_chain, "
obytes
")) == -1LL)
continue;
ksp[numif++] = ksp_chain;
}
continue;
ksp[numif++] = ksp_chain;
}
@@
-219,18
+213,19
@@
static int interface_read (void)
for (if_ptr = if_list; if_ptr != NULL; if_ptr = if_ptr->ifa_next)
{
for (if_ptr = if_list; if_ptr != NULL; if_ptr = if_ptr->ifa_next)
{
- if (
(if_data = (struct IFA_DATA *) if_ptr->ifa_data) == NULL)
-
continue
;
+ if (
if_ptr->ifa_addr != NULL && if_ptr->ifa_addr->sa_family == AF_LINK) {
+
if_data = (struct IFA_DATA *) if_ptr->ifa_data
;
- if_submit (if_ptr->ifa_name, "if_octets",
+
if_submit (if_ptr->ifa_name, "if_octets",
if_data->IFA_RX_BYTES,
if_data->IFA_TX_BYTES);
if_data->IFA_RX_BYTES,
if_data->IFA_TX_BYTES);
- if_submit (if_ptr->ifa_name, "if_packets",
+
if_submit (if_ptr->ifa_name, "if_packets",
if_data->IFA_RX_PACKT,
if_data->IFA_TX_PACKT);
if_data->IFA_RX_PACKT,
if_data->IFA_TX_PACKT);
- if_submit (if_ptr->ifa_name, "if_errors",
+
if_submit (if_ptr->ifa_name, "if_errors",
if_data->IFA_RX_ERROR,
if_data->IFA_TX_ERROR);
if_data->IFA_RX_ERROR,
if_data->IFA_TX_ERROR);
+ }
}
freeifaddrs (if_list);
}
freeifaddrs (if_list);