From: Florian Forster Date: Mon, 18 Aug 2014 07:50:34 +0000 (+0200) Subject: Merge branch 'collectd-5.4' X-Git-Tag: collectd-5.5.0~222 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=103f05e098865196fc5f28df51e99b64fd6b5202 Merge branch 'collectd-5.4' Conflicts: configure.ac src/curl_json.c src/lvm.c src/write_riemann.c --- 103f05e098865196fc5f28df51e99b64fd6b5202 diff --cc configure.ac index 92fd8778,d38cbb5d..0df56782 --- a/configure.ac +++ b/configure.ac @@@ -1233,12 -1233,14 +1244,14 @@@ AC_CACHE_CHECK([if have htonll defined] return htonll(0); ]]] )], - [ - have_htonll="yes" - AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.]) - ]) - - AC_MSG_RESULT([$have_htonll]) + [c_cv_have_htonll="yes"], + [c_cv_have_htonll="no"] - ) ++ ) + ) + if test "x$c_cv_have_htonll" = "xyes" + then + AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.]) + fi # Check for structures AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors], @@@ -3576,61 -3595,43 +3596,96 @@@ f CPPFLAGS="$SAVE_CPPFLAGS" LDFLAGS="$SAVE_LDFLAGS" AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes") + + with_amqp_tcp_socket="no" + if test "x$with_librabbitmq" = "xyes" + then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags" + LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags" + LIBS="-lrabbitmq" + + AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h) + AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"]) + if test "x$with_amqp_tcp_socket" = "xyes" + then + AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1, + [Define if librabbitmq provides the new TCP socket interface.]) + fi + + AC_CHECK_DECLS(amqp_socket_close, + [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"], + [[ + #include + #ifdef HAVE_AMQP_TCP_SOCKET_H + # include + #endif + #ifdef HAVE_AMQP_SOCKET_H + # include + #endif + ]]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" + fi # }}} +# --with-librdkafka {{{ +AC_ARG_WITH(librdkafka, [AS_HELP_STRING([--with-librdkafka@<:@=PREFIX@:>@], [Path to librdkafka.])], +[ + if test "x$withval" = "xno" && test "x$withval" != "xyes" + then + with_librdkafka_cppflags="-I$withval/include" + with_librdkafka_ldflags="-L$withval/lib" + with_librdkafka="yes" + else + with_librdkafka="$withval" + fi +], +[ + with_librdkafka="yes" +]) +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +if test "x$with_librdkafka" = "xyes" +then + AC_CHECK_HEADERS(librdkafka/rdkafka.h, [with_librdkafka="yes"], [with_librdkafka="no (librdkafka/rdkafka.h not found)"]) +fi + +if test "x$with_librdkafka" = "xyes" +then + AC_CHECK_LIB(rdkafka, rd_kafka_new, [with_librdkafka="yes"], [with_librdkafka="no (Symbol 'rd_kafka_new' not found)"]) + AC_CHECK_LIB(rdkafka, rd_kafka_conf_set_log_cb, [with_librdkafka_log_cb="yes"], [with_librdkafka_log_cb="no"]) + AC_CHECK_LIB(rdkafka, rd_kafka_conf_set_logger, [with_librdkafka_logger="yes"], [with_librdkafka_logger="no"]) +fi +if test "x$with_librdkafka" = "xyes" +then + BUILD_WITH_LIBRDKAFKA_CPPFLAGS="$with_librdkafka_cppflags" + BUILD_WITH_LIBRDKAFKA_LDFLAGS="$with_librdkafka_ldflags" + BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka" + AC_SUBST(BUILD_WITH_LIBRDKAFKA_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBRDKAFKA_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBRDKAFKA_LIBS) + AC_DEFINE(HAVE_LIBRDKAFKA, 1, [Define if librdkafka is present and usable.]) + if test "x$with_librdkafka_log_cb" = "xyes" + then + AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.]) + fi + if test "x$with_librdkafka_logger" = "xyes" + then + AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.]) + fi +fi +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" +AM_CONDITIONAL(BUILD_WITH_LIBRDKAFKA, test "x$with_librdkafka" = "xyes") + +# }}} + # --with-librouteros {{{ AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])], [ diff --cc src/collectd.conf.pod index acd0cbbe,81c8f4c6..3a8af849 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@@ -494,8 -494,10 +494,10 @@@ possibly filtering or messages # StoreRates false # GraphitePrefix "collectd." # GraphiteEscapeChar "_" + # GraphiteSeparateInstances false + # GraphiteAlwaysAppendDS false - + # Receive values from an AMQP broker Host "localhost" diff --cc src/curl_json.c index 6a015902,9e0f6723..a84cba04 --- a/src/curl_json.c +++ b/src/curl_json.c @@@ -726,10 -714,7 +726,10 @@@ static int cj_config_add_url (oconfig_i if (status == 0) { user_data_t ud; - char cb_name[DATA_MAX_NAME_LEN]; + char *cb_name; + struct timespec interval = { 0, 0 }; + + CDTIME_T_TO_TIMESPEC (db->interval, &interval); if (db->instance == NULL) db->instance = strdup("default"); @@@ -741,12 -726,12 +741,13 @@@ ud.data = (void *) db; ud.free_func = cj_free; - ssnprintf (cb_name, sizeof (cb_name), "curl_json-%s-%s", + cb_name = ssnprintf_alloc ("curl_json-%s-%s", db->instance, db->url ? db->url : db->sock); - plugin_register_complex_read (/* group = */ "curl_json", cb_name, cj_read, - /* interval = */ NULL, &ud); + plugin_register_complex_read (/* group = */ NULL, cb_name, cj_read, + /* interval = */ (db->interval > 0) ? &interval : NULL, + &ud); + sfree (cb_name); } else { diff --cc src/lvm.c index 9e245423,12c621d0..82d7f6fe --- a/src/lvm.c +++ b/src/lvm.c @@@ -125,37 -59,10 +125,41 @@@ static void vg_read(vg_t vg, char cons } dm_list_iterate_items(lvl, lvs) { + lvm_submit(vg_name, lvm_lv_get_name(lvl->lv), lvm_lv_get_size(lvl->lv)); + } + - return (0); ++ dm_list_iterate_items(lvl, lvs) { + name = lvm_lv_get_name(lvl->lv); + attrs = get_lv_property_string(lvl->lv, "lv_attr"); + size = lvm_lv_get_size(lvl->lv); + if (name == NULL || attrs == NULL || size == NO_VALUE) + continue; + + /* Condition on volume type. We want the reported sizes in the + volume group to sum to the size of the volume group, so we ignore + virtual volumes. */ + switch (attrs[0]) { + case 's': + case 'S': + /* Snapshot. Also report used/free space. */ + report_lv_utilization(lvl->lv, vg_name, name, size, + "data_percent"); + break; + case 't': + /* Thin pool virtual volume. We report the underlying data + and metadata volumes, not this one. Report used/free + space, then ignore. */ + report_thin_pool_utilization(lvl->lv, vg_name, size); + continue; + case 'v': + /* Virtual volume. Ignore. */ + continue; + case 'V': + /* Thin volume or thin snapshot. Ignore. */ + continue; + } + lvm_submit(vg_name, name, size); + } } static int lvm_read(void) diff --cc src/write_riemann.c index 78f01c05,a404ff6e..b59c3e35 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@@ -51,8 -44,6 +51,8 @@@ struct riemann_host #define F_CONNECT 0x01 uint8_t flags; pthread_mutex_t lock; - _Bool notifications; - _Bool check_thresholds; ++ _Bool notifications; ++ _Bool check_thresholds; _Bool store_rates; _Bool always_append_ds; char *node; @@@ -459,11 -435,10 +459,11 @@@ static Msg *riemann_notification_to_pro return (msg); } /* }}} Msg *riemann_notification_to_protobuf */ - static Event *riemann_value_to_protobuf (struct riemann_host const *host, /* {{{ */ + static Event *riemann_value_to_protobuf(struct riemann_host const *host, /* {{{ */ data_set_t const *ds, value_list_t const *vl, size_t index, - gauge_t const *rates) + gauge_t const *rates, + int status) { Event *event; char name_buffer[5 * DATA_MAX_NAME_LEN]; @@@ -484,23 -459,6 +484,23 @@@ event->time = CDTIME_T_TO_TIME_T (vl->time); event->has_time = 1; - if (host->check_thresholds) { - switch (status) { - case STATE_OKAY: - event->state = strdup("ok"); - break; - case STATE_ERROR: - event->state = strdup("critical"); - break; - case STATE_WARNING: - event->state = strdup("warning"); - break; - case STATE_MISSING: - event->state = strdup("unknown"); - break; - } - } ++ if (host->check_thresholds) { ++ switch (status) { ++ case STATE_OKAY: ++ event->state = strdup("ok"); ++ break; ++ case STATE_ERROR: ++ event->state = strdup("critical"); ++ break; ++ case STATE_WARNING: ++ event->state = strdup("warning"); ++ break; ++ case STATE_MISSING: ++ event->state = strdup("unknown"); ++ break; ++ } ++ } + ttl = CDTIME_T_TO_DOUBLE (vl->interval) * host->ttl_factor; event->ttl = (float) ttl; event->has_ttl = 1; @@@ -645,9 -597,6 +645,9 @@@ static int riemann_notification(const n struct riemann_host *host = ud->data; Msg *msg; - if (!host->notifications) - return 0; ++ if (!host->notifications) ++ return 0; + msg = riemann_notification_to_protobuf (host, n); if (msg == NULL) return (-1); @@@ -670,9 -618,7 +670,9 @@@ static int riemann_write(const data_set struct riemann_host *host = ud->data; Msg *msg; - if (host->check_thresholds) - write_riemann_threshold_check(ds, vl, statuses); - msg = riemann_value_list_to_protobuf (host, ds, vl); ++ if (host->check_thresholds) ++ write_riemann_threshold_check(ds, vl, statuses); + msg = riemann_value_list_to_protobuf (host, ds, vl, statuses); if (msg == NULL) return (-1); @@@ -725,8 -671,6 +725,8 @@@ static int riemann_config_node(oconfig_ host->reference_count = 1; host->node = NULL; host->service = NULL; - host->notifications = 1; - host->check_thresholds = 0; ++ host->notifications = 1; ++ host->check_thresholds = 0; host->store_rates = 1; host->always_append_ds = 0; host->use_tcp = 0; @@@ -751,14 -695,6 +751,14 @@@ status = cf_util_get_string (child, &host->node); if (status != 0) break; - } else if (strcasecmp ("Notifications", child->key) == 0) { - status = cf_util_get_boolean(child, &host->notifications); - if (status != 0) - break; - } else if (strcasecmp ("CheckThresholds", child->key) == 0) { - status = cf_util_get_boolean(child, &host->check_thresholds); - if (status != 0) - break; ++ } else if (strcasecmp ("Notifications", child->key) == 0) { ++ status = cf_util_get_boolean(child, &host->notifications); ++ if (status != 0) ++ break; ++ } else if (strcasecmp ("CheckThresholds", child->key) == 0) { ++ status = cf_util_get_boolean(child, &host->check_thresholds); ++ if (status != 0) ++ break; } else if (strcasecmp ("Port", child->key) == 0) { status = cf_util_get_service (child, &host->service); if (status != 0) { diff --cc version-gen.sh index 7fbc8671,95b15d8a..6b5e40e5 --- a/version-gen.sh +++ b/version-gen.sh @@@ -1,8 -1,8 +1,8 @@@ #!/usr/bin/env bash - DEFAULT_VERSION="5.4.0.git" + DEFAULT_VERSION="5.4.1.git" -VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`" +VERSION="`git describe 2> /dev/null | grep collectd | sed -e 's/^collectd-//'`" if test -z "$VERSION"; then VERSION="$DEFAULT_VERSION"