Code

Merge branch 'collectd-5.4'
authorFlorian Forster <octo@collectd.org>
Mon, 18 Aug 2014 07:50:34 +0000 (09:50 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 18 Aug 2014 07:50:34 +0000 (09:50 +0200)
Conflicts:
configure.ac
src/curl_json.c
src/lvm.c
src/write_riemann.c

24 files changed:
1  2 
ChangeLog
configure.ac
contrib/redhat/collectd.spec
src/Makefile.am
src/amqp.c
src/apache.c
src/collectd-unixsock.pod
src/collectd.conf.in
src/collectd.conf.pod
src/common.c
src/configfile.c
src/curl.c
src/curl_json.c
src/curl_xml.c
src/exec.c
src/lvm.c
src/network.c
src/processes.c
src/snmp.c
src/tcpconns.c
src/utils_vl_lookup.c
src/write_http.c
src/write_riemann.c
version-gen.sh

diff --cc ChangeLog
Simple merge
diff --cc configure.ac
index 92fd87786d030d39303277ae150c468d3b629e7e,d38cbb5d21f938a4d2c4964af01b50233407edfb..0df5678245b1483dc4810a90c7984db51da39270
@@@ -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],
  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 <amqp.h>
+ #ifdef HAVE_AMQP_TCP_SOCKET_H
+ # include <amqp_tcp_socket.h>
+ #endif
+ #ifdef HAVE_AMQP_SOCKET_H
+ # include <amqp_socket.h>
+ #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.])],
  [
Simple merge
diff --cc src/Makefile.am
Simple merge
diff --cc src/amqp.c
Simple merge
diff --cc src/apache.c
Simple merge
Simple merge
Simple merge
index acd0cbbe1f6a5deb5fc46e0592d954272646936a,81c8f4c6ccd958dcb3cac9d3b9dcadb3aa0d20d3..3a8af849b722a33bdfa08ef44c03c311f0a03cde
@@@ -494,8 -494,10 +494,10 @@@ possibly filtering or messages
   #   StoreRates false
   #   GraphitePrefix "collectd."
   #   GraphiteEscapeChar "_"
+  #   GraphiteSeparateInstances false
+  #   GraphiteAlwaysAppendDS false
     </Publish>
 -   
 +
     # Receive values from an AMQP broker
     <Subscribe "some_name">
       Host "localhost"
diff --cc src/common.c
Simple merge
Simple merge
diff --cc src/curl.c
Simple merge
diff --cc src/curl_json.c
index 6a01590217883d985ee7098934d6387ed1cdee54,9e0f6723c35c363198a3f1df165a6c5e8dcdb444..a84cba042b924d6e3b7667066889ead4ab41ca72
@@@ -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");
      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/curl_xml.c
Simple merge
diff --cc src/exec.c
Simple merge
diff --cc src/lvm.c
index 9e245423fef2c829d842619a3a77ee8213864ae4,12c621d0569f7b9d05eabdab9c9f043974cd5e28..82d7f6fef0006854c0b64cd1be712e79a2015901
+++ b/src/lvm.c
@@@ -121,41 -55,14 +121,45 @@@ static void vg_read(vg_t vg, char cons
      lvs = lvm_vg_list_lvs(vg);
      if (!lvs) {
          /* no VGs are defined, which is not an error per se */
 -        return (0);
 +        return;
      }
  
 -    return (0);
+     dm_list_iterate_items(lvl, lvs) {
+          lvm_submit(vg_name, lvm_lv_get_name(lvl->lv), lvm_lv_get_size(lvl->lv));
+     }
 +    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/network.c
Simple merge
diff --cc src/processes.c
Simple merge
diff --cc src/snmp.c
Simple merge
diff --cc src/tcpconns.c
Simple merge
Simple merge
Simple merge
index 78f01c05e51da1d45fcdfe5e209008a184d83ec5,a404ff6e19470f10f52f8926d89b7f5225c037e4..b59c3e35a2fd0082e75d0c8776437d9965b8158f
@@@ -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];
        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;
                        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 7fbc86718d5bafb06cacbe3a85b054b216a847f9,95b15d8a8af3e066a5891f4cbdc859b1bb4615b8..6b5e40e5c90cbfd883b5a810005b8cbfd9a436b8
@@@ -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"