From: Marc Fournier Date: Tue, 15 May 2018 13:37:45 +0000 (+0100) Subject: Merge pull request #2776 from mfournier/unblock_pr_2737 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=d5456237d0de8f9905ea7a32f2bbae52b5e3ea73;hp=0c854759d82a28a5b4c20ad30a97e1b1f23295bc Merge pull request #2776 from mfournier/unblock_pr_2737 Unblock #2737 --- diff --git a/docs/BUILD.dpdkstat.md b/docs/BUILD.dpdkstat.md index 96f1eb95..457fc0fa 100644 --- a/docs/BUILD.dpdkstat.md +++ b/docs/BUILD.dpdkstat.md @@ -1,7 +1,17 @@ # The dpdkstat plugin +This plugin is optional and only has a specific use case: monitoring DPDK applications +that don't expose stats in any other way than the DPDK xstats API. + **Data Plane Development Kit** (DPDK) is a set of drivers and libraries for fast -packet processing. +packet processing. Please note that this plugin is a polling based plugin rather +than an events based plugin (using it will drive up core utilization on a system). + +**PLEASE DO NOT USE THIS PLUGIN FOR OVS-DPDK**. dpdkstat is really for DPDK +applications that have no other way of exposing stats. For OVS or OVS-with-DPDK the +Open vSwitch plugins available in collectd 5.8.0 should be used for +collecting stats and events. In addition the OVS plugin is events based rather +than polling based and will have a smaller footprint on the system. ## Summary diff --git a/src/perl.c b/src/perl.c index 1bb0b333..8df8fd4b 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1642,23 +1642,23 @@ static void _plugin_register_generic_userdata(pTHX, int type, */ static XS(Collectd_plugin_register_read) { - return _plugin_register_generic_userdata(aTHX, PLUGIN_READ, "read"); + _plugin_register_generic_userdata(aTHX, PLUGIN_READ, "read"); } static XS(Collectd_plugin_register_write) { - return _plugin_register_generic_userdata(aTHX, PLUGIN_WRITE, "write"); + _plugin_register_generic_userdata(aTHX, PLUGIN_WRITE, "write"); } static XS(Collectd_plugin_register_log) { - return _plugin_register_generic_userdata(aTHX, PLUGIN_LOG, "log"); + _plugin_register_generic_userdata(aTHX, PLUGIN_LOG, "log"); } static XS(Collectd_plugin_register_notification) { - return _plugin_register_generic_userdata(aTHX, PLUGIN_NOTIF, "notification"); + _plugin_register_generic_userdata(aTHX, PLUGIN_NOTIF, "notification"); } static XS(Collectd_plugin_register_flush) { - return _plugin_register_generic_userdata(aTHX, PLUGIN_FLUSH, "flush"); + _plugin_register_generic_userdata(aTHX, PLUGIN_FLUSH, "flush"); } typedef int perl_unregister_function_t(const char *name); @@ -1685,8 +1685,6 @@ static void _plugin_unregister_generic(pTHX, perl_unregister_function_t *unreg, unreg(SvPV_nolen(ST(0))); XSRETURN_EMPTY; - - return; } /* static void _plugin_unregister_generic ( ... ) */ /* @@ -1700,24 +1698,24 @@ static void _plugin_unregister_generic(pTHX, perl_unregister_function_t *unreg, */ static XS(Collectd_plugin_unregister_read) { - return _plugin_unregister_generic(aTHX, plugin_unregister_read, "read"); + _plugin_unregister_generic(aTHX, plugin_unregister_read, "read"); } static XS(Collectd_plugin_unregister_write) { - return _plugin_unregister_generic(aTHX, plugin_unregister_write, "write"); + _plugin_unregister_generic(aTHX, plugin_unregister_write, "write"); } static XS(Collectd_plugin_unregister_log) { - return _plugin_unregister_generic(aTHX, plugin_unregister_log, "log"); + _plugin_unregister_generic(aTHX, plugin_unregister_log, "log"); } static XS(Collectd_plugin_unregister_notification) { - return _plugin_unregister_generic(aTHX, plugin_unregister_notification, - "notification"); + _plugin_unregister_generic(aTHX, plugin_unregister_notification, + "notification"); } static XS(Collectd_plugin_unregister_flush) { - return _plugin_unregister_generic(aTHX, plugin_unregister_flush, "flush"); + _plugin_unregister_generic(aTHX, plugin_unregister_flush, "flush"); } /* diff --git a/src/write_kafka.c b/src/write_kafka.c index 3c573801..2baaf0e5 100644 --- a/src/write_kafka.c +++ b/src/write_kafka.c @@ -77,6 +77,14 @@ static void kafka_log(const rd_kafka_t *rkt, int level, const char *fac, } #endif +static rd_kafka_resp_err_t kafka_error() { +#if RD_KAFKA_VERSION >= 0x000b00ff + return rd_kafka_last_error(); +#else + return rd_kafka_errno2err(errno); +#endif +} + static uint32_t kafka_hash(const char *keydata, size_t keylen) { uint32_t hash = 5381; for (; keylen > 0; keylen--) @@ -147,7 +155,7 @@ static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */ if ((ctx->topic = rd_kafka_topic_new(ctx->kafka, ctx->topic_name, topic_conf)) == NULL) { ERROR("write_kafka plugin: cannot create topic : %s\n", - rd_kafka_err2str(rd_kafka_errno2err(errno))); + rd_kafka_err2str(kafka_error())); return errno; } diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 9e9ed2e8..7c4e59e7 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -764,6 +764,16 @@ static int prom_open_socket(int addrfamily) { if (fd == -1) continue; + int tmp = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)) != 0) { + char errbuf[1024]; + WARNING("write_prometheus: setsockopt(SO_REUSEADDR) failed: %s", + sstrerror(errno, errbuf, sizeof(errbuf))); + close(fd); + fd = -1; + continue; + } + if (bind(fd, ai->ai_addr, ai->ai_addrlen) != 0) { close(fd); fd = -1;