From: Pavel Rochnyack Date: Mon, 7 May 2018 16:39:35 +0000 (+0700) Subject: netlink plugin: Report `rx_nohandler` stats X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cc1e32e35aa90b91f4b9900e82389c94c3ffc9ce;p=collectd.git netlink plugin: Report `rx_nohandler` stats Added metric for new counter from Linux kernel version 4.6+. Issue: #2510 --- diff --git a/configure.ac b/configure.ac index 4fe2b72a..f37d6dad 100644 --- a/configure.ac +++ b/configure.ac @@ -3660,6 +3660,18 @@ if test "x$with_libmnl" = "xyes"; then [[#include ]] ) + AC_CHECK_MEMBERS([struct rtnl_link_stats.rx_nohandler], + [], + [], + [[#include ]] + ) + + AC_CHECK_MEMBERS([struct rtnl_link_stats64.rx_nohandler], + [], + [], + [[#include ]] + ) + AC_CHECK_LIB([mnl], [mnl_nlmsg_get_payload], [with_libmnl="yes"], [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"], diff --git a/src/netlink.c b/src/netlink.c index d5cbeba0..051458f6 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -56,6 +56,7 @@ struct ir_link_stats_storage_s { uint64_t tx_dropped; uint64_t multicast; uint64_t collisions; + uint64_t rx_nohandler; uint64_t rx_length_errors; uint64_t rx_over_errors; @@ -253,6 +254,10 @@ static void check_ignorelist_and_submit(const char *dev, submit_two(dev, "if_dropped", NULL, stats->rx_dropped, stats->tx_dropped); submit_one(dev, "if_multicast", NULL, stats->multicast); submit_one(dev, "if_collisions", NULL, stats->collisions); +#if defined(HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER) || \ + defined(HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER) + submit_one(dev, "if_rx_nohandler", NULL, stats->rx_nohandler); +#endif submit_one(dev, "if_rx_errors", "length", stats->rx_length_errors); submit_one(dev, "if_rx_errors", "over", stats->rx_over_errors); @@ -304,6 +309,9 @@ static void check_ignorelist_and_submit64(const char *dev, struct ir_link_stats_storage_s s; COPY_RTNL_LINK_STATS(&s, stats); +#ifdef HAVE_STRUCT_RTNL_LINK_STATS64_RX_NOHANDLER + COPY_RTNL_LINK_VALUE(&s, stats, rx_nohandler); +#endif check_ignorelist_and_submit(dev, &s); } @@ -314,6 +322,9 @@ static void check_ignorelist_and_submit32(const char *dev, struct ir_link_stats_storage_s s; COPY_RTNL_LINK_STATS(&s, stats); +#ifdef HAVE_STRUCT_RTNL_LINK_STATS_RX_NOHANDLER + COPY_RTNL_LINK_VALUE(&s, stats, rx_nohandler); +#endif check_ignorelist_and_submit(dev, &s); } diff --git a/src/types.db b/src/types.db index f27ba465..1b1e6f0c 100644 --- a/src/types.db +++ b/src/types.db @@ -111,6 +111,7 @@ if_octets rx:DERIVE:0:U, tx:DERIVE:0:U if_packets rx:DERIVE:0:U, tx:DERIVE:0:U if_rx_dropped value:DERIVE:0:U if_rx_errors value:DERIVE:0:U +if_rx_nohandler value:DERIVE:0:U if_rx_octets value:DERIVE:0:U if_rx_packets value:DERIVE:0:U if_tx_dropped value:DERIVE:0:U