Merge branch 'pr/1791'
authorFlorian Forster <octo@collectd.org>
Mon, 1 Aug 2016 09:12:48 +0000 (11:12 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 1 Aug 2016 09:12:48 +0000 (11:12 +0200)
80 files changed:
.gitignore
ChangeLog
configure.ac
contrib/redhat/collectd.spec
proto/collectd.proto
src/Makefile.am
src/apache.c
src/battery.c
src/chrony.c
src/collectd-nagios.c
src/collectd-tg.c
src/collectd.conf.pod
src/collectdctl.c
src/conntrack.c
src/curl.c
src/curl_json.c
src/curl_xml.c
src/daemon/collectd.c
src/daemon/collectd.h
src/daemon/common.c
src/daemon/meta_data.c
src/daemon/plugin.c
src/daemon/utils_avltree.c
src/daemon/utils_cache.c
src/daemon/utils_cache.h
src/daemon/utils_cache_mock.c
src/daemon/utils_heap.c
src/daemon/utils_llist.c
src/daemon/utils_threshold.c
src/disk.c
src/email.c
src/ethstat.c
src/fscache.c
src/gmond.c
src/grpc.cc
src/interface.c
src/libcollectdclient/client.c
src/libcollectdclient/collectd/client.h
src/libcollectdclient/network_buffer.c
src/log_logstash.c
src/madwifi.c
src/match_empty_counter.c
src/match_hashed.c
src/match_timediff.c
src/memcachec.c
src/memcached.c
src/modbus.c
src/mqtt.c
src/mysql.c
src/network.c
src/ntpd.c
src/openldap.c
src/processes.c
src/redis.c
src/rrdtool.c
src/smart.c
src/statsd.c
src/teamspeak2.c
src/ted.c
src/threshold.c
src/types.db
src/utils_cmd_putval.c
src/utils_curl_stats.c
src/utils_dns.c
src/utils_fbhash.c
src/utils_format_kairosdb.c [new file with mode: 0644]
src/utils_format_kairosdb.h [new file with mode: 0644]
src/utils_parse_option.c
src/utils_vl_lookup.c
src/uuid.c
src/varnish.c
src/virt.c
src/write_graphite.c
src/write_http.c
src/write_kafka.c
src/write_riemann.c
src/write_riemann_threshold.c
src/zone.c
src/zookeeper.c
version-gen.sh

index 3e26ccd..d742389 100644 (file)
@@ -78,6 +78,9 @@ bindings/java/org/collectd/java/*.class
 # backup stuff
 *~
 
+# lint stuff
+*.ln
+
 # Unit tests
 src/daemon/test-suite.log
 src/tests/
index 48dc6ca..25257d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+2016-07-25, Version 5.5.2
+       * collectd: A division by zero has been fixed in the
+         "plugin_dispatch_multivalue()" function. Thanks to Corey Kosak.
+       * collectd: The address of the Free Software Foundation has been fixed
+         in GPL license headers. Thanks to Ruben Kerkhof.
+       * Build system: Detection and handling of librrd 1.6 and later has been
+         fixed. Thanks to Ruben Kerkof.
+       * Apache plugin: A warning about a possible misconfiguration has been
+         added. Thanks to Marc Fournier.
+       * cURL, cURL-JSON and cURL-XML plugins: A memory leak when allocating
+         more memory fails has been fixed. Thanks to Brandon Arp.
+       * DF plugin: A build issue on DragonFlyBSD has been fixed. Thanks to
+         Ruben Kerkhof. #1575
+       * Ethstat plugin: Code to strip leading whitespace from device names.
+         This works around an issue in the VMXNet3 driver. Thanks to Thomas
+         Guthmann. #1059
+       * Exec plugin: A problem in the error handling of an fdopen() failure
+         has been fixed. Thanks to @ciomaire.
+       * Modbus plugin: The debug output has been disabled by default. It is
+         now only enabled when building with "--enable-debug". Thanks to Eric
+         Sandeen and Marc Fournier.
+       * Network plugin: A check for the initialization of secure memory has
+         been added. Previously, failure to initialize this memory was
+         ignored. Thanks to @yujokang. #1665
+       * Network plugin: A heap overflow has been fixed in the server code.
+         This issue can be triggered remotely and is potentially exploitable.
+         Thanks to Emilien Gaspar. CVE-2016-6254
+       * Perl plugin: Init callbacks have been changed to run essentially
+         single-threaded to avoid race conditions by init functions which
+         create additional threads. Thanks to Pavel Rochnyack. #1706
+       * Processes plugin: A warning about too long process names has been
+         added. Thanks to Marc Fournier. #1284
+       * Redis plugin: A memory leak in an error handling code path has been
+         fixed. Thanks to Andrés J. Díaz.
+       * Redis plugin: The data source type of the expired_keys metric has been
+         corrected to "DERIVE". Thanks to Marc Falzon and Marc Fournier. #1483.
+       * SMART plugin: A build dependency on libudev has been added. Thanks to
+         Pavel Rochnyack. #1724
+       * StatsD plugin: A deadlock on plugin shutdown has been fixed. Thanks to
+         Pavel Rochnyack #1703
+       * Write HTTP plugin: Freeing of memory holding HTTP headers during
+         shutdown has been fixed. Thanks to Tolga Ceylan.
+       * Write Sensu plugin: A segfault when the Tag was unset has been fixed.
+         Thanks to Marc Fournier.
+       * ZFS ARC plugin: The cache_operation-stolen metric has been removed for
+         FreeBSD 10.2 and later. Thanks to Ruben Kerkhof. #1580
+
 2016-01-22, Version 5.5.1
        * Build system: Compilation errors have been avoided by correctly
          defining package name and version used by autoconf. Thanks to Nathan
          Marc Fournier and Wilfried Goesgens. #552
        * Zookeeper plugin: This new plugin reads data from the Apache Zookeeper
          "MNTR" command. Thanks to Jeremy Katz. #826
+=======
+       * Processes plugin and Swap plugin: These plugins have been corrected to
+         also work inside FreeBSD jails. Thanks to biancalana. #1019
+       * Processes plugin: A warning about too long process names has been
+         added. Thanks to Marc Fournier. #1284
+       * Processes plugin: Process counting on the FreeBSD and OpenBSD
+         platforms has been fixed. Thanks to Herve COMMOWICK. #1298
+       * Processes plugin: The plugin was fixed to work properly on Solaris.
+         Thanks to Jan Andres. #919
+       * Python plugin: A double-free bug got fixed. Thanks to Sven Trenkel.
+         #1285
+       * RRDtool plugin: A race condition leading to corrupt RRD file creation
+         has been fixed. Thanks to Manuel Luis Sanmartín Rozada. #1031
+       * SNMP plugin: The "Gauge32" signedness was corrected to match RFC1902.
+         Thanks to Nathan Ward. #1325
+       * StatsD plugin: A deadlock on plugin shutdown has been fixed. Thanks to
+         Pavel Rochnyack #1703
+       * StatsD plugin: A memory leak was corrected. Thanks to Florian Forster.
+         #997
+       * StatsD plugin: A symbol lookup error was fixed by properly linking the
+         plugin against libm. Thanks to Florian Forster.
+       * StatsD plugin: "utils_latency": Support for including values above
+         1000 in percentile calculation has been added. Thanks to Yoga
+         Ramalingam. #401
+       * StatsD plugin: "utils_latency": Two division by zero error conditions
+         have been corrected. Thanks to Wilfried Goesgens. #655
+       * StatsD plugin: Counters absolute counts are now also reported. Thanks
+         to Pierre-Yves Ritschard. #1311
+       * StatsD plugin: The plugin now emits NaN values when no timer event is
+         recorded. Thanks to Florian Forster. #1038, #1039
+       * StatsD plugin: The plugin was corrected to avoid crashing when
+         negative timer values are submitted. Thanks to Florian Forster. #1131
+       * Tail CSV plugin: The plugin was fixed to work properly with multiple
+         "Collect" options and a bug got fixed when no "TimeFrom" is specified.
+         Thanks to Manuel Luis Sanmartín Rozada and Florian Forster. #1032
+       * TCPConns plugin: A memory leak was fixed. Thanks to Florian Forster.
+         #1074
+       * TCPConns plugin: An bug causing collectd to enter an inifinite loop on
+         OpenBSD was fixed. Thanks to Landry Breuil. #1094
+       * Threshold plugin: Threshold configuration blocks can now be defined in
+         different files. Thanks to Michael Salmon. #551
+       * vmem plugin: Support for pgsteal in recent Linux kernels has been
+         added. Thanks to Jakub Jankowski. #1307
+       * vmem plugin: The DSType for nr_dirtied and nr_written was corrected to
+         report a derive. Thanks to Marek Becka. #1072
+       * Write Graphite plugin: Error handling when submitting metrics to the
+         server is now more robust. Thanks to Sam Pointer. #1364
+       * Write HTTP plugin: Freeing of memory holding HTTP headers during
+         shutdown has been fixed. Thanks to Tolga Ceylan.
+       * Write Redis plugin: Multi-Valued key was made easier to parse by
+         adding a "|" character as a delimiter. Thanks to brianpkelly and
+         Florian Forster. #1070
+       * Write Redis plugin: The timestamp format was corrected. Thanks to
+         Florian Forster.
+       * ZFS ARC plugin: The plugin was will not emit warning about missing
+         "l2_size" stats anymore. Thanks to Jan Andres. #919
+       * 152 patches have been applied to numerous plugins and core components,
+         fixing various programming errors which were reported by scan-build,
+         libasan, FBInfer, coverity-scan, clang and gcc-6: Thanks to Ruben
+         Kerkhof, Florian Forster, Marc Fournier, Corey Kosak, Laurent,
+         Claudius Zingerli and Fabien Wernli.
+>>>>>>> collectd-5.4
 
 2015-02-26, Version 5.4.2
        * Build system: Numerous fixes. Thanks to Bjørn Nordbø, Jim Radford,
index 62de3ec..a1c3303 100644 (file)
@@ -1621,18 +1621,32 @@ AC_CHECK_LIB(resolv, res_search,
 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
 
 dnl Check for HAL (hardware abstraction library)
-with_libhal="yes"
-AC_CHECK_LIB(hal,libhal_device_property_exists,
-            [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
-            [with_libhal="no"])
-if test "x$with_libhal" = "xyes"; then
-       if test "x$PKG_CONFIG" != "x"; then
-               BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
-               BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
-               AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
-               AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
-       fi
-fi
+with_libhal="no"
+PKG_CHECK_MODULES([HAL], [hal],
+  [
+    SAVE_LIBS="$LIBS"
+    LIBS="$HAL_LIBS $LIBS"
+    AC_CHECK_LIB([hal], [libhal_device_property_exists],
+      [
+        SAVE_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$HAL_CFLAGS $CPPFLAGS"
+        AC_CHECK_HEADERS([libhal.h],
+        [
+          with_libhal="yes"
+          BUILD_WITH_LIBHAL_CFLAGS="$HAL_CFLAGS"
+          BUILD_WITH_LIBHAL_LIBS="$HAL_LIBS"
+        ])
+        CPPFLAGS="$SAVE_CPPFLAGS"
+      ],
+      [ : ]
+    )
+    LIBS="$SAVE_LIBS"
+  ],
+  [ : ]
+)
+AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
+AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
+
 
 SAVE_LIBS="$LIBS"
 AC_CHECK_LIB([pthread],
@@ -3869,14 +3883,12 @@ PATH="$with_python_path"
 
 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
 then
-       AC_MSG_CHECKING([for python])
-       with_python_prog="`which python 2>/dev/null`"
-       if test "x$with_python_prog" = "x"
+       AC_PATH_PROG([PYTHON], [python])
+       if test "x$PYTHON" = "x"
        then
-               AC_MSG_RESULT([not found])
                with_python="no (interpreter not found)"
        else
-               AC_MSG_RESULT([$with_python_prog])
+               with_python_prog="$PYTHON"
        fi
 fi
 
@@ -4872,6 +4884,7 @@ then
        AC_SUBST(LIBXENCTL_CPPFLAGS)
        AC_SUBST(LIBXENCTL_LDFLAGS)
 fi
+# }}}
 
 # --with-libxmms {{{
 with_xmms_config="xmms-config"
@@ -6262,232 +6275,230 @@ then
        with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
 fi
 
-cat <<EOF;
-
-Configuration:
-  Build:
-    Platform  . . . . . . $ac_system
-    CC  . . . . . . . . . $CC
-    CFLAGS  . . . . . . . $AM_CFLAGS $CFLAGS
-    CXXFLAGS  . . . . . . $AM_CXXFLAGS $CXXFLAGS
-    CPP . . . . . . . . . $CPP
-    CPPFLAGS  . . . . . . $CPPFLAGS
-    GRPC_CPP_PLUGIN . . . $GRPC_CPP_PLUGIN
-    LD  . . . . . . . . . $LD
-    LDFLAGS . . . . . . . $LDFLAGS
-    PROTOC  . . . . . . . $PROTOC
-    YACC  . . . . . . . . $YACC
-    YFLAGS  . . . . . . . $YFLAGS
-
-  Libraries:
-    intel mic . . . . . . $with_mic
-    libaquaero5 . . . . . $with_libaquaero5
-    libatasmart . . . . . $with_libatasmart
-    libcurl . . . . . . . $with_libcurl
-    libdbi  . . . . . . . $with_libdbi
-    libesmtp  . . . . . . $with_libesmtp
-    libganglia  . . . . . $with_libganglia
-    libgcrypt . . . . . . $with_libgcrypt
-    libgrpc . . . . . . . $with_libgrpc
-    libhal  . . . . . . . $with_libhal
-    libhiredis  . . . . . $with_libhiredis
-    libi2c-dev  . . . . . $with_libi2c
-    libiokit  . . . . . . $with_libiokit
-    libiptc . . . . . . . $with_libiptc
-    libjvm  . . . . . . . $with_java
-    libkstat  . . . . . . $with_kstat
-    libkvm  . . . . . . . $with_libkvm
-    libldap . . . . . . . $with_libldap
-    liblvm2app  . . . . . $with_liblvm2app
-    libmemcached  . . . . $with_libmemcached
-    libmnl  . . . . . . . $with_libmnl
-    libmodbus . . . . . . $with_libmodbus
-    libmongoc . . . . . . $with_libmongoc
-    libmosquitto  . . . . $with_libmosquitto
-    libmysql  . . . . . . $with_libmysql
-    libnetapp . . . . . . $with_libnetapp
-    libnetsnmp  . . . . . $with_libnetsnmp
-    libnotify . . . . . . $with_libnotify
-    liboconfig  . . . . . $with_liboconfig
-    libopenipmi . . . . . $with_libopenipmipthread
-    liboping  . . . . . . $with_liboping
-    libowcapi . . . . . . $with_libowcapi
-    libpcap . . . . . . . $with_libpcap
-    libperfstat . . . . . $with_perfstat
-    libperl . . . . . . . $with_libperl
-    libpq . . . . . . . . $with_libpq
-    librabbitmq . . . . . $with_librabbitmq
-    libriemann-client . . $with_libriemann_client
-    librdkafka  . . . . . $with_librdkafka
-    librouteros . . . . . $with_librouteros
-    librrd  . . . . . . . $with_librrd
-    libsensors  . . . . . $with_libsensors
-    libsigrok   . . . . . $with_libsigrok
-    libstatgrab . . . . . $with_libstatgrab
-    libtokyotyrant  . . . $with_libtokyotyrant
-    libudev . . . . . . . $with_libudev
-    libupsclient  . . . . $with_libupsclient
-    libvarnish  . . . . . $with_libvarnish
-    libvirt . . . . . . . $with_libvirt
-    libxenctrl  . . . . . $with_libxenctrl
-    libxml2 . . . . . . . $with_libxml2
-    libxmms . . . . . . . $with_libxmms
-    libyajl . . . . . . . $with_libyajl
-    oracle  . . . . . . . $with_oracle
-    protobuf-c  . . . . . $have_protoc_c
-    protoc 3  . . . . . . $protoc3
-    python  . . . . . . . $with_python
-
-  Features:
-    daemon mode . . . . . $enable_daemon
-    debug . . . . . . . . $enable_debug
-
-  Bindings:
-    perl  . . . . . . . . $with_perl_bindings
-
-  Modules:
-    aggregation . . . . . $enable_aggregation
-    amqp    . . . . . . . $enable_amqp
-    apache  . . . . . . . $enable_apache
-    apcups  . . . . . . . $enable_apcups
-    apple_sensors . . . . $enable_apple_sensors
-    aquaero . . . . . . . $enable_aquaero
-    ascent  . . . . . . . $enable_ascent
-    barometer . . . . . . $enable_barometer
-    battery . . . . . . . $enable_battery
-    bind  . . . . . . . . $enable_bind
-    ceph  . . . . . . . . $enable_ceph
-    cgroups . . . . . . . $enable_cgroups
-    chrony. . . . . . . . $enable_chrony
-    conntrack . . . . . . $enable_conntrack
-    contextswitch . . . . $enable_contextswitch
-    cpu . . . . . . . . . $enable_cpu
-    cpufreq . . . . . . . $enable_cpufreq
-    csv . . . . . . . . . $enable_csv
-    curl  . . . . . . . . $enable_curl
-    curl_json . . . . . . $enable_curl_json
-    curl_xml  . . . . . . $enable_curl_xml
-    dbi . . . . . . . . . $enable_dbi
-    df  . . . . . . . . . $enable_df
-    disk  . . . . . . . . $enable_disk
-    dns . . . . . . . . . $enable_dns
-    drbd  . . . . . . . . $enable_drbd
-    email . . . . . . . . $enable_email
-    entropy . . . . . . . $enable_entropy
-    ethstat . . . . . . . $enable_ethstat
-    exec  . . . . . . . . $enable_exec
-    fhcount . . . . . . . $enable_fhcount
-    filecount . . . . . . $enable_filecount
-    fscache . . . . . . . $enable_fscache
-    gmond . . . . . . . . $enable_gmond
-    grpc  . . . . . . . . $enable_grpc
-    hddtemp . . . . . . . $enable_hddtemp
-    interface . . . . . . $enable_interface
-    ipc . . . . . . . . . $enable_ipc
-    ipmi  . . . . . . . . $enable_ipmi
-    iptables  . . . . . . $enable_iptables
-    ipvs  . . . . . . . . $enable_ipvs
-    irq . . . . . . . . . $enable_irq
-    java  . . . . . . . . $enable_java
-    load  . . . . . . . . $enable_load
-    logfile . . . . . . . $enable_logfile
-    log_logstash  . . . . $enable_log_logstash
-    lpar  . . . . . . . . $enable_lpar
-    lvm . . . . . . . . . $enable_lvm
-    madwifi . . . . . . . $enable_madwifi
-    match_empty_counter . $enable_match_empty_counter
-    match_hashed  . . . . $enable_match_hashed
-    match_regex . . . . . $enable_match_regex
-    match_timediff  . . . $enable_match_timediff
-    match_value . . . . . $enable_match_value
-    mbmon . . . . . . . . $enable_mbmon
-    md  . . . . . . . . . $enable_md
-    memcachec . . . . . . $enable_memcachec
-    memcached . . . . . . $enable_memcached
-    memory  . . . . . . . $enable_memory
-    mic . . . . . . . . . $enable_mic
-    modbus  . . . . . . . $enable_modbus
-    mqtt  . . . . . . . . $enable_mqtt
-    multimeter  . . . . . $enable_multimeter
-    mysql . . . . . . . . $enable_mysql
-    netapp  . . . . . . . $enable_netapp
-    netlink . . . . . . . $enable_netlink
-    network . . . . . . . $enable_network
-    nfs . . . . . . . . . $enable_nfs
-    nginx . . . . . . . . $enable_nginx
-    notify_desktop  . . . $enable_notify_desktop
-    notify_email  . . . . $enable_notify_email
-    notify_nagios . . . . $enable_notify_nagios
-    ntpd  . . . . . . . . $enable_ntpd
-    numa  . . . . . . . . $enable_numa
-    nut . . . . . . . . . $enable_nut
-    olsrd . . . . . . . . $enable_olsrd
-    onewire . . . . . . . $enable_onewire
-    openldap  . . . . . . $enable_openldap
-    openvpn . . . . . . . $enable_openvpn
-    oracle  . . . . . . . $enable_oracle
-    perl  . . . . . . . . $enable_perl
-    pf  . . . . . . . . . $enable_pf
-    pinba . . . . . . . . $enable_pinba
-    ping  . . . . . . . . $enable_ping
-    postgresql  . . . . . $enable_postgresql
-    powerdns  . . . . . . $enable_powerdns
-    processes . . . . . . $enable_processes
-    protocols . . . . . . $enable_protocols
-    python  . . . . . . . $enable_python
-    redis . . . . . . . . $enable_redis
-    routeros  . . . . . . $enable_routeros
-    rrdcached . . . . . . $enable_rrdcached
-    rrdtool . . . . . . . $enable_rrdtool
-    sensors . . . . . . . $enable_sensors
-    serial  . . . . . . . $enable_serial
-    sigrok  . . . . . . . $enable_sigrok
-    smart . . . . . . . . $enable_smart
-    snmp  . . . . . . . . $enable_snmp
-    statsd  . . . . . . . $enable_statsd
-    swap  . . . . . . . . $enable_swap
-    syslog  . . . . . . . $enable_syslog
-    table . . . . . . . . $enable_table
-    tail_csv  . . . . . . $enable_tail_csv
-    tail  . . . . . . . . $enable_tail
-    tape  . . . . . . . . $enable_tape
-    target_notification . $enable_target_notification
-    target_replace  . . . $enable_target_replace
-    target_scale  . . . . $enable_target_scale
-    target_set  . . . . . $enable_target_set
-    target_v5upgrade  . . $enable_target_v5upgrade
-    tcpconns  . . . . . . $enable_tcpconns
-    teamspeak2  . . . . . $enable_teamspeak2
-    ted . . . . . . . . . $enable_ted
-    thermal . . . . . . . $enable_thermal
-    threshold . . . . . . $enable_threshold
-    tokyotyrant . . . . . $enable_tokyotyrant
-    turbostat . . . . . . $enable_turbostat
-    unixsock  . . . . . . $enable_unixsock
-    uptime  . . . . . . . $enable_uptime
-    users . . . . . . . . $enable_users
-    uuid  . . . . . . . . $enable_uuid
-    varnish . . . . . . . $enable_varnish
-    virt  . . . . . . . . $enable_virt
-    vmem  . . . . . . . . $enable_vmem
-    vserver . . . . . . . $enable_vserver
-    wireless  . . . . . . $enable_wireless
-    write_graphite  . . . $enable_write_graphite
-    write_http  . . . . . $enable_write_http
-    write_kafka . . . . . $enable_write_kafka
-    write_log . . . . . . $enable_write_log
-    write_mongodb . . . . $enable_write_mongodb
-    write_redis . . . . . $enable_write_redis
-    write_riemann . . . . $enable_write_riemann
-    write_sensu . . . . . $enable_write_sensu
-    write_tsdb  . . . . . $enable_write_tsdb
-    xencpu  . . . . . . . $enable_xencpu
-    xmms  . . . . . . . . $enable_xmms
-    zfs_arc . . . . . . . $enable_zfs_arc
-    zone  . . . . . . . . $enable_zone
-    zookeeper . . . . . . $enable_zookeeper
-
-EOF
+AC_MSG_RESULT()
+AC_MSG_RESULT([Configuration:])
+AC_MSG_RESULT([  Build:])
+AC_MSG_RESULT([    Platform  . . . . . . $ac_system])
+AC_MSG_RESULT([    CC  . . . . . . . . . $CC])
+AC_MSG_RESULT([    CFLAGS  . . . . . . . $AM_CFLAGS $CFLAGS])
+AC_MSG_RESULT([    CXXFLAGS  . . . . . . $AM_CXXFLAGS $CXXFLAGS])
+AC_MSG_RESULT([    CPP . . . . . . . . . $CPP])
+AC_MSG_RESULT([    CPPFLAGS  . . . . . . $CPPFLAGS])
+AC_MSG_RESULT([    GRPC_CPP_PLUGIN . . . $GRPC_CPP_PLUGIN])
+AC_MSG_RESULT([    LD  . . . . . . . . . $LD])
+AC_MSG_RESULT([    LDFLAGS . . . . . . . $LDFLAGS])
+AC_MSG_RESULT([    PROTOC  . . . . . . . $PROTOC])
+AC_MSG_RESULT([    YACC  . . . . . . . . $YACC])
+AC_MSG_RESULT([    YFLAGS  . . . . . . . $YFLAGS])
+AC_MSG_RESULT()
+AC_MSG_RESULT([  Libraries:])
+AC_MSG_RESULT([    intel mic . . . . . . $with_mic])
+AC_MSG_RESULT([    libaquaero5 . . . . . $with_libaquaero5])
+AC_MSG_RESULT([    libatasmart . . . . . $with_libatasmart])
+AC_MSG_RESULT([    libcurl . . . . . . . $with_libcurl])
+AC_MSG_RESULT([    libdbi  . . . . . . . $with_libdbi])
+AC_MSG_RESULT([    libesmtp  . . . . . . $with_libesmtp])
+AC_MSG_RESULT([    libganglia  . . . . . $with_libganglia])
+AC_MSG_RESULT([    libgcrypt . . . . . . $with_libgcrypt])
+AC_MSG_RESULT([    libgrpc . . . . . . . $with_libgrpc])
+AC_MSG_RESULT([    libhal  . . . . . . . $with_libhal])
+AC_MSG_RESULT([    libhiredis  . . . . . $with_libhiredis])
+AC_MSG_RESULT([    libi2c-dev  . . . . . $with_libi2c])
+AC_MSG_RESULT([    libiokit  . . . . . . $with_libiokit])
+AC_MSG_RESULT([    libiptc . . . . . . . $with_libiptc])
+AC_MSG_RESULT([    libjvm  . . . . . . . $with_java])
+AC_MSG_RESULT([    libkstat  . . . . . . $with_kstat])
+AC_MSG_RESULT([    libkvm  . . . . . . . $with_libkvm])
+AC_MSG_RESULT([    libldap . . . . . . . $with_libldap])
+AC_MSG_RESULT([    liblvm2app  . . . . . $with_liblvm2app])
+AC_MSG_RESULT([    libmemcached  . . . . $with_libmemcached])
+AC_MSG_RESULT([    libmnl  . . . . . . . $with_libmnl])
+AC_MSG_RESULT([    libmodbus . . . . . . $with_libmodbus])
+AC_MSG_RESULT([    libmongoc . . . . . . $with_libmongoc])
+AC_MSG_RESULT([    libmosquitto  . . . . $with_libmosquitto])
+AC_MSG_RESULT([    libmysql  . . . . . . $with_libmysql])
+AC_MSG_RESULT([    libnetapp . . . . . . $with_libnetapp])
+AC_MSG_RESULT([    libnetsnmp  . . . . . $with_libnetsnmp])
+AC_MSG_RESULT([    libnotify . . . . . . $with_libnotify])
+AC_MSG_RESULT([    liboconfig  . . . . . $with_liboconfig])
+AC_MSG_RESULT([    libopenipmi . . . . . $with_libopenipmipthread])
+AC_MSG_RESULT([    liboping  . . . . . . $with_liboping])
+AC_MSG_RESULT([    libowcapi . . . . . . $with_libowcapi])
+AC_MSG_RESULT([    libpcap . . . . . . . $with_libpcap])
+AC_MSG_RESULT([    libperfstat . . . . . $with_perfstat])
+AC_MSG_RESULT([    libperl . . . . . . . $with_libperl])
+AC_MSG_RESULT([    libpq . . . . . . . . $with_libpq])
+AC_MSG_RESULT([    librabbitmq . . . . . $with_librabbitmq])
+AC_MSG_RESULT([    libriemann-client . . $with_libriemann_client])
+AC_MSG_RESULT([    librdkafka  . . . . . $with_librdkafka])
+AC_MSG_RESULT([    librouteros . . . . . $with_librouteros])
+AC_MSG_RESULT([    librrd  . . . . . . . $with_librrd])
+AC_MSG_RESULT([    libsensors  . . . . . $with_libsensors])
+AC_MSG_RESULT([    libsigrok   . . . . . $with_libsigrok])
+AC_MSG_RESULT([    libstatgrab . . . . . $with_libstatgrab])
+AC_MSG_RESULT([    libtokyotyrant  . . . $with_libtokyotyrant])
+AC_MSG_RESULT([    libudev . . . . . . . $with_libudev])
+AC_MSG_RESULT([    libupsclient  . . . . $with_libupsclient])
+AC_MSG_RESULT([    libvarnish  . . . . . $with_libvarnish])
+AC_MSG_RESULT([    libvirt . . . . . . . $with_libvirt])
+AC_MSG_RESULT([    libxenctrl  . . . . . $with_libxenctrl])
+AC_MSG_RESULT([    libxml2 . . . . . . . $with_libxml2])
+AC_MSG_RESULT([    libxmms . . . . . . . $with_libxmms])
+AC_MSG_RESULT([    libyajl . . . . . . . $with_libyajl])
+AC_MSG_RESULT([    oracle  . . . . . . . $with_oracle])
+AC_MSG_RESULT([    protobuf-c  . . . . . $have_protoc_c])
+AC_MSG_RESULT([    protoc 3  . . . . . . $protoc3])
+AC_MSG_RESULT([    python  . . . . . . . $with_python])
+AC_MSG_RESULT()
+AC_MSG_RESULT([  Features:])
+AC_MSG_RESULT([    daemon mode . . . . . $enable_daemon])
+AC_MSG_RESULT([    debug . . . . . . . . $enable_debug])
+AC_MSG_RESULT()
+AC_MSG_RESULT([  Bindings:])
+AC_MSG_RESULT([    perl  . . . . . . . . $with_perl_bindings])
+AC_MSG_RESULT()
+AC_MSG_RESULT([  Modules:])
+AC_MSG_RESULT([    aggregation . . . . . $enable_aggregation])
+AC_MSG_RESULT([    amqp    . . . . . . . $enable_amqp])
+AC_MSG_RESULT([    apache  . . . . . . . $enable_apache])
+AC_MSG_RESULT([    apcups  . . . . . . . $enable_apcups])
+AC_MSG_RESULT([    apple_sensors . . . . $enable_apple_sensors])
+AC_MSG_RESULT([    aquaero . . . . . . . $enable_aquaero])
+AC_MSG_RESULT([    ascent  . . . . . . . $enable_ascent])
+AC_MSG_RESULT([    barometer . . . . . . $enable_barometer])
+AC_MSG_RESULT([    battery . . . . . . . $enable_battery])
+AC_MSG_RESULT([    bind  . . . . . . . . $enable_bind])
+AC_MSG_RESULT([    ceph  . . . . . . . . $enable_ceph])
+AC_MSG_RESULT([    cgroups . . . . . . . $enable_cgroups])
+AC_MSG_RESULT([    chrony. . . . . . . . $enable_chrony])
+AC_MSG_RESULT([    conntrack . . . . . . $enable_conntrack])
+AC_MSG_RESULT([    contextswitch . . . . $enable_contextswitch])
+AC_MSG_RESULT([    cpu . . . . . . . . . $enable_cpu])
+AC_MSG_RESULT([    cpufreq . . . . . . . $enable_cpufreq])
+AC_MSG_RESULT([    csv . . . . . . . . . $enable_csv])
+AC_MSG_RESULT([    curl  . . . . . . . . $enable_curl])
+AC_MSG_RESULT([    curl_json . . . . . . $enable_curl_json])
+AC_MSG_RESULT([    curl_xml  . . . . . . $enable_curl_xml])
+AC_MSG_RESULT([    dbi . . . . . . . . . $enable_dbi])
+AC_MSG_RESULT([    df  . . . . . . . . . $enable_df])
+AC_MSG_RESULT([    disk  . . . . . . . . $enable_disk])
+AC_MSG_RESULT([    dns . . . . . . . . . $enable_dns])
+AC_MSG_RESULT([    drbd  . . . . . . . . $enable_drbd])
+AC_MSG_RESULT([    email . . . . . . . . $enable_email])
+AC_MSG_RESULT([    entropy . . . . . . . $enable_entropy])
+AC_MSG_RESULT([    ethstat . . . . . . . $enable_ethstat])
+AC_MSG_RESULT([    exec  . . . . . . . . $enable_exec])
+AC_MSG_RESULT([    fhcount . . . . . . . $enable_fhcount])
+AC_MSG_RESULT([    filecount . . . . . . $enable_filecount])
+AC_MSG_RESULT([    fscache . . . . . . . $enable_fscache])
+AC_MSG_RESULT([    gmond . . . . . . . . $enable_gmond])
+AC_MSG_RESULT([    grpc  . . . . . . . . $enable_grpc])
+AC_MSG_RESULT([    hddtemp . . . . . . . $enable_hddtemp])
+AC_MSG_RESULT([    interface . . . . . . $enable_interface])
+AC_MSG_RESULT([    ipc . . . . . . . . . $enable_ipc])
+AC_MSG_RESULT([    ipmi  . . . . . . . . $enable_ipmi])
+AC_MSG_RESULT([    iptables  . . . . . . $enable_iptables])
+AC_MSG_RESULT([    ipvs  . . . . . . . . $enable_ipvs])
+AC_MSG_RESULT([    irq . . . . . . . . . $enable_irq])
+AC_MSG_RESULT([    java  . . . . . . . . $enable_java])
+AC_MSG_RESULT([    load  . . . . . . . . $enable_load])
+AC_MSG_RESULT([    logfile . . . . . . . $enable_logfile])
+AC_MSG_RESULT([    log_logstash  . . . . $enable_log_logstash])
+AC_MSG_RESULT([    lpar  . . . . . . . . $enable_lpar])
+AC_MSG_RESULT([    lvm . . . . . . . . . $enable_lvm])
+AC_MSG_RESULT([    madwifi . . . . . . . $enable_madwifi])
+AC_MSG_RESULT([    match_empty_counter . $enable_match_empty_counter])
+AC_MSG_RESULT([    match_hashed  . . . . $enable_match_hashed])
+AC_MSG_RESULT([    match_regex . . . . . $enable_match_regex])
+AC_MSG_RESULT([    match_timediff  . . . $enable_match_timediff])
+AC_MSG_RESULT([    match_value . . . . . $enable_match_value])
+AC_MSG_RESULT([    mbmon . . . . . . . . $enable_mbmon])
+AC_MSG_RESULT([    md  . . . . . . . . . $enable_md])
+AC_MSG_RESULT([    memcachec . . . . . . $enable_memcachec])
+AC_MSG_RESULT([    memcached . . . . . . $enable_memcached])
+AC_MSG_RESULT([    memory  . . . . . . . $enable_memory])
+AC_MSG_RESULT([    mic . . . . . . . . . $enable_mic])
+AC_MSG_RESULT([    modbus  . . . . . . . $enable_modbus])
+AC_MSG_RESULT([    mqtt  . . . . . . . . $enable_mqtt])
+AC_MSG_RESULT([    multimeter  . . . . . $enable_multimeter])
+AC_MSG_RESULT([    mysql . . . . . . . . $enable_mysql])
+AC_MSG_RESULT([    netapp  . . . . . . . $enable_netapp])
+AC_MSG_RESULT([    netlink . . . . . . . $enable_netlink])
+AC_MSG_RESULT([    network . . . . . . . $enable_network])
+AC_MSG_RESULT([    nfs . . . . . . . . . $enable_nfs])
+AC_MSG_RESULT([    nginx . . . . . . . . $enable_nginx])
+AC_MSG_RESULT([    notify_desktop  . . . $enable_notify_desktop])
+AC_MSG_RESULT([    notify_email  . . . . $enable_notify_email])
+AC_MSG_RESULT([    notify_nagios . . . . $enable_notify_nagios])
+AC_MSG_RESULT([    ntpd  . . . . . . . . $enable_ntpd])
+AC_MSG_RESULT([    numa  . . . . . . . . $enable_numa])
+AC_MSG_RESULT([    nut . . . . . . . . . $enable_nut])
+AC_MSG_RESULT([    olsrd . . . . . . . . $enable_olsrd])
+AC_MSG_RESULT([    onewire . . . . . . . $enable_onewire])
+AC_MSG_RESULT([    openldap  . . . . . . $enable_openldap])
+AC_MSG_RESULT([    openvpn . . . . . . . $enable_openvpn])
+AC_MSG_RESULT([    oracle  . . . . . . . $enable_oracle])
+AC_MSG_RESULT([    perl  . . . . . . . . $enable_perl])
+AC_MSG_RESULT([    pf  . . . . . . . . . $enable_pf])
+AC_MSG_RESULT([    pinba . . . . . . . . $enable_pinba])
+AC_MSG_RESULT([    ping  . . . . . . . . $enable_ping])
+AC_MSG_RESULT([    postgresql  . . . . . $enable_postgresql])
+AC_MSG_RESULT([    powerdns  . . . . . . $enable_powerdns])
+AC_MSG_RESULT([    processes . . . . . . $enable_processes])
+AC_MSG_RESULT([    protocols . . . . . . $enable_protocols])
+AC_MSG_RESULT([    python  . . . . . . . $enable_python])
+AC_MSG_RESULT([    redis . . . . . . . . $enable_redis])
+AC_MSG_RESULT([    routeros  . . . . . . $enable_routeros])
+AC_MSG_RESULT([    rrdcached . . . . . . $enable_rrdcached])
+AC_MSG_RESULT([    rrdtool . . . . . . . $enable_rrdtool])
+AC_MSG_RESULT([    sensors . . . . . . . $enable_sensors])
+AC_MSG_RESULT([    serial  . . . . . . . $enable_serial])
+AC_MSG_RESULT([    sigrok  . . . . . . . $enable_sigrok])
+AC_MSG_RESULT([    smart . . . . . . . . $enable_smart])
+AC_MSG_RESULT([    snmp  . . . . . . . . $enable_snmp])
+AC_MSG_RESULT([    statsd  . . . . . . . $enable_statsd])
+AC_MSG_RESULT([    swap  . . . . . . . . $enable_swap])
+AC_MSG_RESULT([    syslog  . . . . . . . $enable_syslog])
+AC_MSG_RESULT([    table . . . . . . . . $enable_table])
+AC_MSG_RESULT([    tail_csv  . . . . . . $enable_tail_csv])
+AC_MSG_RESULT([    tail  . . . . . . . . $enable_tail])
+AC_MSG_RESULT([    tape  . . . . . . . . $enable_tape])
+AC_MSG_RESULT([    target_notification . $enable_target_notification])
+AC_MSG_RESULT([    target_replace  . . . $enable_target_replace])
+AC_MSG_RESULT([    target_scale  . . . . $enable_target_scale])
+AC_MSG_RESULT([    target_set  . . . . . $enable_target_set])
+AC_MSG_RESULT([    target_v5upgrade  . . $enable_target_v5upgrade])
+AC_MSG_RESULT([    tcpconns  . . . . . . $enable_tcpconns])
+AC_MSG_RESULT([    teamspeak2  . . . . . $enable_teamspeak2])
+AC_MSG_RESULT([    ted . . . . . . . . . $enable_ted])
+AC_MSG_RESULT([    thermal . . . . . . . $enable_thermal])
+AC_MSG_RESULT([    threshold . . . . . . $enable_threshold])
+AC_MSG_RESULT([    tokyotyrant . . . . . $enable_tokyotyrant])
+AC_MSG_RESULT([    turbostat . . . . . . $enable_turbostat])
+AC_MSG_RESULT([    unixsock  . . . . . . $enable_unixsock])
+AC_MSG_RESULT([    uptime  . . . . . . . $enable_uptime])
+AC_MSG_RESULT([    users . . . . . . . . $enable_users])
+AC_MSG_RESULT([    uuid  . . . . . . . . $enable_uuid])
+AC_MSG_RESULT([    varnish . . . . . . . $enable_varnish])
+AC_MSG_RESULT([    virt  . . . . . . . . $enable_virt])
+AC_MSG_RESULT([    vmem  . . . . . . . . $enable_vmem])
+AC_MSG_RESULT([    vserver . . . . . . . $enable_vserver])
+AC_MSG_RESULT([    wireless  . . . . . . $enable_wireless])
+AC_MSG_RESULT([    write_graphite  . . . $enable_write_graphite])
+AC_MSG_RESULT([    write_http  . . . . . $enable_write_http])
+AC_MSG_RESULT([    write_kafka . . . . . $enable_write_kafka])
+AC_MSG_RESULT([    write_log . . . . . . $enable_write_log])
+AC_MSG_RESULT([    write_mongodb . . . . $enable_write_mongodb])
+AC_MSG_RESULT([    write_redis . . . . . $enable_write_redis])
+AC_MSG_RESULT([    write_riemann . . . . $enable_write_riemann])
+AC_MSG_RESULT([    write_sensu . . . . . $enable_write_sensu])
+AC_MSG_RESULT([    write_tsdb  . . . . . $enable_write_tsdb])
+AC_MSG_RESULT([    xencpu  . . . . . . . $enable_xencpu])
+AC_MSG_RESULT([    xmms  . . . . . . . . $enable_xmms])
+AC_MSG_RESULT([    zfs_arc . . . . . . . $enable_zfs_arc])
+AC_MSG_RESULT([    zone  . . . . . . . . $enable_zone])
+AC_MSG_RESULT([    zookeeper . . . . . . $enable_zookeeper])
+AC_MSG_RESULT()
 
 if test "x$dependency_error" = "xyes"; then
        AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
index b6d709e..5b018f8 100644 (file)
 
 Summary:       Statistics collection and monitoring daemon
 Name:          collectd
-Version:       5.5.1
+Version:       5.5.2
 Release:       1%{?dist}
-URL:           http://collectd.org
-Source:                http://collectd.org/files/%{name}-%{version}.tar.bz2
+URL:           https://collectd.org
+Source:                https://collectd.org/files/%{name}-%{version}.tar.bz2
 License:       GPLv2
 Group:         System Environment/Daemons
 BuildRoot:     %{_tmppath}/%{name}-%{version}-root
-BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel, libcap-devel
+BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel, libcap-devel, which
 Vendor:                collectd development team <collectd@verplant.org>
 
 %if 0%{?fedora} || 0%{?rhel} >= 7
@@ -781,7 +781,7 @@ using HTTP POST requests.
 Summary:       Write-kafka plugin for collectd
 Group:         System Environment/Daemons
 Requires:      %{name}%{?_isa} = %{version}-%{release}
-BuildRequires: rdkafka-devel
+BuildRequires: librdkafka-devel
 %description write_kafka
 The write_kafka plugin sends values to kafka, a distributed messaging system.
 %endif
@@ -2445,6 +2445,11 @@ fi
 %doc contrib/
 
 %changelog
+* Tue Jul 26 2016 Ruben Kerkhof <ruben@rubenkerkhof.com> - 5.5.2-1
+- New upstream version
+- Contains fix for CVE-2016-6254
+- Change collectd.org url to https
+
 * Sat Jun 04 2016 Ruben Kerkhof <ruben@rubenkerkhof.com> 5.5.1-1
 - New upstream version
 - New plugins enabled by default: chrony, mqtt, notify_nagios
index 608fcbb..5134dbf 100644 (file)
@@ -27,7 +27,6 @@ syntax = "proto3";
 package collectd;
 
 import "types.proto";
-import "google/protobuf/timestamp.proto";
 
 service Collectd {
        // Dispatch collected values to collectd.
index 641e2fa..93045e2 100644 (file)
@@ -1221,7 +1221,8 @@ endif
 if BUILD_PLUGIN_WRITE_HTTP
 pkglib_LTLIBRARIES += write_http.la
 write_http_la_SOURCES = write_http.c \
-                       utils_format_json.c utils_format_json.h
+                       utils_format_json.c utils_format_json.h \
+                       utils_format_kairosdb.c utils_format_kairosdb.h
 write_http_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBCURL_CFLAGS)
 write_http_la_LDFLAGS = $(PLUGIN_LDFLAGS)
 write_http_la_LIBADD = $(BUILD_WITH_LIBCURL_LIBS)
index 2e91a1b..40d0efe 100644 (file)
@@ -63,8 +63,10 @@ typedef struct apache_s apache_t;
 /* TODO: Remove this prototype */
 static int apache_read_host (user_data_t *user_data);
 
-static void apache_free (apache_t *st)
+static void apache_free (void *arg)
 {
+       apache_t *st = arg;
+
        if (st == NULL)
                return;
 
@@ -243,7 +245,7 @@ static int config_add (oconfig_item_t *ci)
 
                memset (&ud, 0, sizeof (ud));
                ud.data = st;
-               ud.free_func = (void *) apache_free;
+               ud.free_func = apache_free;
 
                memset (callback_name, 0, sizeof (callback_name));
                ssnprintf (callback_name, sizeof (callback_name),
index 8a96e89..4e0c06f 100644 (file)
@@ -27,8 +27,6 @@
 #include "common.h"
 #include "plugin.h"
 
-#include "utils_complain.h"
-
 #if HAVE_MACH_MACH_TYPES_H
 #  include <mach/mach_types.h>
 #endif
index 23ad992..012fd9a 100644 (file)
@@ -105,8 +105,8 @@ typedef enum
 } eDaemonReplies;
 
 
-#if defined(__GNUC__)
-#  /* GNU gcc extension to enforce struct packing. */
+#if defined(__GNUC__) || defined (__SUNPRO_C) || defined(lint)
+#  /* extension to enforce struct packing. */
 #  define ATTRIB_PACKED __attribute__((packed))
 #else
 #  error Not defining packed attribute (unknown compiler)
index fe56d5d..dd90737 100644 (file)
@@ -618,9 +618,9 @@ static int do_check (lcc_connection_t *connection)
 
        status = RET_UNKNOWN;
        if (consolitation_g == CON_NONE)
-               status =  do_check_con_none (values_num, values, values_names);
+               status = do_check_con_none (values_num, values, values_names);
        else if (consolitation_g == CON_AVERAGE)
-               status =  do_check_con_average (values_num, values, values_names);
+               status = do_check_con_average (values_num, values, values_names);
        else if (consolitation_g == CON_SUM)
                status = do_check_con_sum (values_num, values, values_names);
        else if (consolitation_g == CON_PERCENTAGE)
index 23257fd..513d4ff 100644 (file)
@@ -46,7 +46,6 @@
 
 #include "libcollectdclient/collectd/client.h"
 #include "libcollectdclient/collectd/network.h"
-#include "libcollectdclient/collectd/network_buffer.h"
 
 #define DEF_NUM_HOSTS    1000
 #define DEF_NUM_PLUGINS    20
@@ -451,7 +450,6 @@ int main (int argc, char **argv) /* {{{ */
 
   lcc_network_destroy (net);
   exit (EXIT_SUCCESS);
-  return (0);
 } /* }}} int main */
 
 /* vim: set sw=2 sts=2 et fdm=marker : */
index 32738dc..ac06547 100644 (file)
@@ -6468,6 +6468,22 @@ collected. If at least one B<Disk> option is given and no B<IgnoreSelected> or
 set to B<false>, B<only> matching disks will be collected. If B<IgnoreSelected>
 is set to B<true>, all disks are collected B<except> the ones matched.
 
+=item B<IgnoreSleepMode> B<true>|B<false>
+
+Normally, the C<smart> plugin will ignore disks that are reported to be asleep.
+This option disables the sleep mode check and allows the plugin to collect data
+from these disks anyway. This is useful in cases where libatasmart mistakenly
+reports disks as asleep because it has not been updated to incorporate support
+for newer idle states in the ATA spec.
+
+=item B<UseSerial> B<true>|B<false>
+
+A disk's kernel name (e.g., sda) can change from one boot to the next. If this
+option is enabled, the C<smart> plugin will use the disk's serial number (e.g.,
+HGST_HUH728080ALE600_2EJ8VH8X) instead of the kernel name as the key for
+storing data. This ensures that the data for a given disk will be kept together
+even if the kernel name changes.
+
 =back
 
 =head2 Plugin C<snmp>
@@ -7805,11 +7821,12 @@ Define which SSL protocol version must be used. By default C<libcurl> will
 attempt to figure out the remote SSL protocol version. See
 L<curl_easy_setopt(3)> for more details.
 
-=item B<Format> B<Command>|B<JSON>
+=item B<Format> B<Command>|B<JSON>|B<KAIROSDB>
 
 Format of the output to generate. If set to B<Command>, will create output that
 is understood by the I<Exec> and I<UnixSock> plugins. When set to B<JSON>, will
-create output in the I<JavaScript Object Notation> (JSON).
+create output in the I<JavaScript Object Notation> (JSON). When set to KAIROSDB
+, will create output in the KairosDB format.
 
 Defaults to B<Command>.
 
index ee11c45..18b3917 100644 (file)
@@ -566,7 +566,6 @@ int main (int argc, char **argv) {
         break;
       case 'h':
         exit_usage (argv[0], 0);
-        break;
       default:
         exit_usage (argv[0], 1);
     }
index 49a3355..486b001 100644 (file)
@@ -135,7 +135,7 @@ static int conntrack_read (void)
 
 void module_register (void)
 {
-    plugin_register_config ("conntrack", conntrack_config,
+       plugin_register_config ("conntrack", conntrack_config,
                             config_keys, config_keys_num);
        plugin_register_read ("conntrack", conntrack_read);
 } /* void module_register */
index cf2e816..d9ced60 100644 (file)
@@ -341,7 +341,7 @@ static int cc_config_add_match (web_page_t *page, /* {{{ */
       match->dstype);
   if (match->match == NULL)
   {
-    ERROR ("curl plugin: tail_match_add_match_simple failed.");
+    ERROR ("curl plugin: match_create_simple failed.");
     cc_web_match_free (match);
     return (-1);
   }
index deb8b6e..55db387 100644 (file)
@@ -968,9 +968,9 @@ static int cj_perform (cj_t *db) /* {{{ */
   }
 
 #if HAVE_YAJL_V2
-    status = yajl_complete_parse(db->yajl);
+  status = yajl_complete_parse(db->yajl);
 #else
-    status = yajl_parse_complete(db->yajl);
+  status = yajl_parse_complete(db->yajl);
 #endif
   if (status != yajl_status_ok)
   {
index 00a980c..e0e4a62 100644 (file)
@@ -116,7 +116,7 @@ static size_t cx_curl_callback (void *buf, /* {{{ */
     return (0);
   }
 
-   if (len == 0)
+  if (len == 0)
     return (len);
 
   if ((db->buffer_fill + len) >= db->buffer_size)
index ce4922d..2fce643 100644 (file)
@@ -35,8 +35,6 @@
 #include <sys/un.h>
 #include <netdb.h>
 
-#include <pthread.h>
-
 #if HAVE_LOCALE_H
 # include <locale.h>
 #endif
index 500bba2..3cb0c1b 100644 (file)
@@ -227,39 +227,39 @@ typedef int _Bool;
 #endif
 
 #ifndef PACKAGE_NAME
-#define PACKAGE_NAME "collectd"
+# define PACKAGE_NAME "collectd"
 #endif
 
 #ifndef PREFIX
-#define PREFIX "/opt/" PACKAGE_NAME
+# define PREFIX "/opt/" PACKAGE_NAME
 #endif
 
 #ifndef SYSCONFDIR
-#define SYSCONFDIR PREFIX "/etc"
+# define SYSCONFDIR PREFIX "/etc"
 #endif
 
 #ifndef CONFIGFILE
-#define CONFIGFILE SYSCONFDIR"/collectd.conf"
+# define CONFIGFILE SYSCONFDIR"/collectd.conf"
 #endif
 
 #ifndef LOCALSTATEDIR
-#define LOCALSTATEDIR PREFIX "/var"
+# define LOCALSTATEDIR PREFIX "/var"
 #endif
 
 #ifndef PKGLOCALSTATEDIR
-#define PKGLOCALSTATEDIR PREFIX "/var/lib/" PACKAGE_NAME
+# define PKGLOCALSTATEDIR PREFIX "/var/lib/" PACKAGE_NAME
 #endif
 
 #ifndef PIDFILE
-#define PIDFILE PREFIX "/var/run/" PACKAGE_NAME ".pid"
+# define PIDFILE PREFIX "/var/run/" PACKAGE_NAME ".pid"
 #endif
 
 #ifndef PLUGINDIR
-#define PLUGINDIR PREFIX "/lib/" PACKAGE_NAME
+# define PLUGINDIR PREFIX "/lib/" PACKAGE_NAME
 #endif
 
 #ifndef PKGDATADIR
-#define PKGDATADIR PREFIX "/share/" PACKAGE_NAME
+# define PKGDATADIR PREFIX "/share/" PACKAGE_NAME
 #endif
 
 #ifndef COLLECTD_GRP_NAME
@@ -270,21 +270,15 @@ typedef int _Bool;
 # define COLLECTD_DEFAULT_INTERVAL 10.0
 #endif
 
- #ifndef COLLECTD_USERAGENT
- # define COLLECTD_USERAGENT PACKAGE_NAME "/" PACKAGE_VERSION
- #endif
+#ifndef COLLECTD_USERAGENT
+# define COLLECTD_USERAGENT PACKAGE_NAME "/" PACKAGE_VERSION
+#endif
 
 /* Only enable __attribute__() for compilers known to support it. */
-#if defined(__clang__)
-# define clang_attr(x) __attribute__(x)
-# define gcc_attr(x) /**/
-#elif __GNUC__
-# define clang_attr(x) /**/
-# define gcc_attr(x) __attribute__(x)
-#else
-# define clang_attr(x) /**/
-# define gcc_attr(x) /**/
-# define __attribute__(x) /**/
+#if !defined(__clang__) && !defined(__GNUC__)
+# if !defined(__attribute__)
+#  define __attribute__(x) /**/
+# endif
 #endif
 
 #if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__
index 4c271d3..f9b1433 100644 (file)
@@ -36,8 +36,6 @@
 #include "plugin.h"
 #include "utils_cache.h"
 
-#include <pthread.h>
-
 #ifdef HAVE_MATH_H
 # include <math.h>
 #endif
index b3f892a..f4a340c 100644 (file)
@@ -28,8 +28,6 @@
 #include "plugin.h"
 #include "meta_data.h"
 
-#include <pthread.h>
-
 /*
  * Data types
  */
@@ -285,6 +283,17 @@ static meta_entry_t *md_entry_lookup (meta_data_t *md, /* {{{ */
 } /* }}} meta_entry_t *md_entry_lookup */
 
 /*
+ * Each value_list_t*, as it is going through the system, is handled by exactly
+ * one thread. Plugins which pass a value_list_t* to another thread, e.g. the
+ * rrdtool plugin, must create a copy first. The meta data within a
+ * value_list_t* is not thread safe and doesn't need to be.
+ *
+ * The meta data associated with cache entries are a different story. There, we
+ * need to ensure exclusive locking to prevent leaks and other funky business.
+ * This is ensured by the uc_meta_data_get_*() functions.
+ */
+
+/*
  * Public functions
  */
 meta_data_t *meta_data_create (void) /* {{{ */
index 3a2e287..9258b88 100644 (file)
@@ -976,7 +976,7 @@ static _Bool plugin_is_loaded (char const *name)
        int status;
 
        if (plugins_loaded == NULL)
-               plugins_loaded = c_avl_create ((void *) strcasecmp);
+               plugins_loaded = c_avl_create ((int (*) (const void *, const void *)) strcasecmp);
        assert (plugins_loaded != NULL);
 
        status = c_avl_get (plugins_loaded, name, /* ret_value = */ NULL);
index 1680c41..e1c41ec 100644 (file)
  *   Florian octo Forster <octo at collectd.org>
  **/
 
-#include "config.h"
-
 #include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include <assert.h>
 
 #include "utils_avltree.h"
index bf8c901..fa592f0 100644 (file)
@@ -34,7 +34,6 @@
 #include "meta_data.h"
 
 #include <assert.h>
-#include <pthread.h>
 
 typedef struct cache_entry_s
 {
index 6c6a883..93c2519 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * collectd - src/utils_cache.h
+ * collectd - utils_cache.h
  * Copyright (C) 2007       Florian octo Forster
  * Copyright (C) 2016       Sebastian tokkee Harl
  *
index 37f21ed..1080c80 100644 (file)
@@ -26,8 +26,8 @@
 
 #include "utils_cache.h"
 
-gauge_t *uc_get_rate (__attribute((unused)) data_set_t const *ds,
-                      __attribute((unused)) value_list_t const *vl)
+gauge_t *uc_get_rate (__attribute__((unused)) data_set_t const *ds,
+                      __attribute__((unused)) value_list_t const *vl)
 {
   return (NULL);
 }
index 19b1d5b..8637581 100644 (file)
@@ -25,7 +25,6 @@
  **/
 
 #include <stdlib.h>
-#include <string.h>
 #include <errno.h>
 #include <assert.h>
 #include <pthread.h>
index 1a6188f..6027338 100644 (file)
@@ -24,8 +24,6 @@
  *   Florian Forster <octo at collectd.org>
  */
 
-#include "config.h"
-
 #include <stdlib.h>
 #include <string.h>
 
index 4a8df89..cb1ea34 100644 (file)
@@ -124,16 +124,16 @@ int ut_search_threshold (const value_list_t *vl, /* {{{ */
   if (vl == NULL)
     return (EINVAL);
 
-       /* Is this lock really necessary? */
-       pthread_mutex_lock (&threshold_lock);
+  /* Is this lock really necessary? */
+  pthread_mutex_lock (&threshold_lock);
   t = threshold_search (vl);
   if (t == NULL) {
-               pthread_mutex_unlock (&threshold_lock);
+    pthread_mutex_unlock (&threshold_lock);
     return (ENOENT);
-       }
+  }
 
   memcpy (ret_threshold, t, sizeof (*ret_threshold));
-       pthread_mutex_unlock (&threshold_lock);
+  pthread_mutex_unlock (&threshold_lock);
 
   ret_threshold->next = NULL;
 
index 292f6e2..9965bca 100644 (file)
@@ -896,7 +896,7 @@ static int disk_read (void)
                {
 #if HAVE_LIBUDEV
                        /* release udev-based alternate name, if allocated */
-                       sfree (output_name);
+                       sfree (alt_name);
 #endif
                        continue;
                }
index 8a1ac2e..db6dd41 100644 (file)
@@ -465,7 +465,6 @@ static void *open_connection (void __attribute__((unused)) *arg)
 
        { /* initialize collector threads */
                int i   = 0;
-               int err = 0;
 
                pthread_attr_t ptattr;
 
@@ -484,10 +483,10 @@ static void *open_connection (void __attribute__((unused)) *arg)
                        collectors[i] = smalloc (sizeof (*collectors[i]));
                        collectors[i]->socket = NULL;
 
-                       if (0 != (err = plugin_thread_create (&collectors[i]->thread,
-                                                       &ptattr, collect, collectors[i]))) {
+                       if (plugin_thread_create (&collectors[i]->thread,
+                                                       &ptattr, collect, collectors[i]) != 0) {
                                char errbuf[1024];
-                               log_err ("pthread_create() failed: %s",
+                               log_err ("plugin_thread_create() failed: %s",
                                                sstrerror (errno, errbuf, sizeof (errbuf)));
                                collectors[i]->thread = (pthread_t) 0;
                        }
@@ -571,13 +570,11 @@ static void *open_connection (void __attribute__((unused)) *arg)
 
 static int email_init (void)
 {
-       int err = 0;
-
-       if (0 != (err = plugin_thread_create (&connector, NULL,
-                               open_connection, NULL))) {
+       if (plugin_thread_create (&connector, NULL,
+                               open_connection, NULL) != 0) {
                char errbuf[1024];
                disabled = 1;
-               log_err ("pthread_create() failed: %s",
+               log_err ("plugin_thread_create() failed: %s",
                                sstrerror (errno, errbuf, sizeof (errbuf)));
                return (-1);
        }
index e10021c..959737a 100644 (file)
@@ -119,7 +119,7 @@ static int ethstat_add_map (const oconfig_item_t *ci) /* {{{ */
 
   if (value_map == NULL)
   {
-    value_map = c_avl_create ((void *) strcmp);
+    value_map = c_avl_create ((int (*) (const void *, const void *)) strcmp);
     if (value_map == NULL)
     {
       sfree (map);
index 8fbd271..68f5c79 100644 (file)
@@ -175,7 +175,7 @@ static void fscache_read_stats_file (FILE *fh)
             section_len--;
             section[section_len] = 0;
         }
-        if (section_len <= 0)
+        if (section_len == 0)
             continue;
 
         fields_num = strsplit (lineptr, fields, STATIC_ARRAY_SIZE (fields));
index 53cdcbf..728162e 100644 (file)
@@ -714,7 +714,7 @@ static int mc_handle_metadata_msg (Ganglia_metadata_msg *msg) /* {{{ */
 
       msg_meta = msg->Ganglia_metadata_msg_u.gfull;
 
-      if (msg_meta.metric.tmax <= 0)
+      if (msg_meta.metric.tmax == 0)
         return (-1);
 
       map = metric_lookup (msg_meta.metric_id.name);
@@ -1107,7 +1107,7 @@ static int gmond_init (void) /* {{{ */
       (mc_receive_port != NULL) ? mc_receive_port : MC_RECEIVE_PORT_DEFAULT,
       /* listen = */ 0);
 
-  staging_tree = c_avl_create ((void *) strcmp);
+  staging_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
   if (staging_tree == NULL)
   {
     ERROR ("gmond plugin: c_avl_create failed.");
index 7517bb7..ae3dab2 100644 (file)
@@ -36,7 +36,6 @@
 extern "C" {
 #include <fnmatch.h>
 #include <stdbool.h>
-#include <pthread.h>
 
 #include "collectd.h"
 #include "common.h"
@@ -288,35 +287,44 @@ static grpc::Status Process(grpc::ServerContext *ctx,
                                grpc::string("failed to query values: cannot create iterator"));
        }
 
+       status = grpc::Status::OK;
        while (uc_iterator_next(iter, &name) == 0) {
                value_list_t res;
-               if (parse_identifier_vl(name, &res) != 0)
-                       return grpc::Status(grpc::StatusCode::INTERNAL,
+               if (parse_identifier_vl(name, &res) != 0) {
+                       status = grpc::Status(grpc::StatusCode::INTERNAL,
                                        grpc::string("failed to parse identifier"));
+                       break;
+               }
 
                if (!ident_matches(&res, &matcher))
                        continue;
 
-               if (uc_iterator_get_time(iter, &res.time) < 0)
-                       return grpc::Status(grpc::StatusCode::INTERNAL,
+               if (uc_iterator_get_time(iter, &res.time) < 0) {
+                       status = grpc::Status(grpc::StatusCode::INTERNAL,
                                        grpc::string("failed to retrieve value timestamp"));
-               if (uc_iterator_get_interval(iter, &res.interval) < 0)
-                       return grpc::Status(grpc::StatusCode::INTERNAL,
+                       break;
+               }
+               if (uc_iterator_get_interval(iter, &res.interval) < 0) {
+                       status = grpc::Status(grpc::StatusCode::INTERNAL,
                                        grpc::string("failed to retrieve value interval"));
-               if (uc_iterator_get_values(iter, &res.values, &res.values_len) < 0)
-                       return grpc::Status(grpc::StatusCode::INTERNAL,
+                       break;
+               }
+               if (uc_iterator_get_values(iter, &res.values, &res.values_len) < 0) {
+                       status = grpc::Status(grpc::StatusCode::INTERNAL,
                                        grpc::string("failed to retrieve values"));
+                       break;
+               }
 
                auto vl = reply->add_values();
                status = marshal_value_list(&res, vl);
                free(res.values);
                if (!status.ok())
-                       return status;
+                       break;
        }
 
        uc_iterator_destroy(iter);
 
-       return grpc::Status::OK;
+       return status;
 } /* Process(): QueryValues */
 
 class Call
index 51be885..5488322 100644 (file)
@@ -139,7 +139,6 @@ static int interface_config (const char *key, const char *value)
 static int interface_init (void)
 {
        kstat_t *ksp_chain;
-       derive_t val;
 
        numif = 0;
 
@@ -156,7 +155,7 @@ static int interface_init (void)
                        continue;
                if (kstat_read (kc, ksp_chain, NULL) == -1)
                        continue;
-               if ((val = get_kstat_value (ksp_chain, "obytes")) == -1LL)
+               if (get_kstat_value (ksp_chain, "obytes") == -1LL)
                        continue;
                ksp[numif++] = ksp_chain;
        }
index 8b5ac0b..77fd576 100644 (file)
@@ -693,7 +693,7 @@ int lcc_getval (lcc_connection_t *c, lcc_identifier_t *ident, /* {{{ */
 
   if (ret_values_names != NULL)
   {
-    values_names = (char **) calloc (values_num, sizeof (*values_names));
+    values_names = calloc (values_num, sizeof (*values_names));
     if (values_names == NULL)
       BAIL_OUT (ENOMEM);
   }
@@ -1062,9 +1062,11 @@ int lcc_string_to_identifier (lcc_connection_t *c, /* {{{ */
   return (0);
 } /* }}} int lcc_string_to_identifier */
 
-int lcc_identifier_compare (const lcc_identifier_t *i0, /* {{{ */
-    const lcc_identifier_t *i1)
+int lcc_identifier_compare (const void *a, /* {{{ */
+    const void *b)
 {
+  const lcc_identifier_t *i0 = a;
+  const lcc_identifier_t *i1 = b;
   int status;
 
   if ((i0 == NULL) && (i1 == NULL))
@@ -1101,7 +1103,7 @@ int lcc_sort_identifiers (lcc_connection_t *c, /* {{{ */
   }
 
   qsort (idents, idents_num, sizeof (*idents),
-      (void *) lcc_identifier_compare);
+      lcc_identifier_compare);
   return (0);
 } /* }}} int lcc_sort_identifiers */
 
index 6ae8598..ac26b84 100644 (file)
@@ -124,8 +124,8 @@ int lcc_string_to_identifier (lcc_connection_t *c,
 /* Compares the identifiers "i0" and "i1" and returns less than zero or greater
  * than zero if "i0" is smaller than or greater than "i1", respectively. If
  * "i0" and "i1" are identical, zero is returned. */
-int lcc_identifier_compare (const lcc_identifier_t *i0,
-    const lcc_identifier_t *i1);
+int lcc_identifier_compare (const void *i0,
+    const void *i1);
 int lcc_sort_identifiers (lcc_connection_t *c,
     lcc_identifier_t *idents, size_t idents_num);
 
index 130da23..49f5576 100644 (file)
@@ -36,7 +36,6 @@
 #include <pthread.h>
 
 #if HAVE_LIBGCRYPT
-# include <pthread.h>
 # if defined __APPLE__
 /* default xcode compiler throws warnings even when deprecated functionality
  * is not used. -Werror breaks the build because of erroneous warnings.
@@ -134,13 +133,16 @@ static _Bool have_gcrypt (void) /* {{{ */
 
 #if HAVE_LIBGCRYPT
 # if GCRYPT_VERSION_NUMBER < 0x010600
-  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+  if (gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
+    return (0);
 # endif
 
   if (!gcry_check_version (GCRYPT_VERSION))
     return (0);
 
-  gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
+  if (!gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0))
+    return (0);
+
   gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
 
   result = 1;
index 45aa86d..3cf636e 100644 (file)
@@ -64,12 +64,12 @@ static int log_logstash_config (const char *key, const char *value)
 
        if (0 == strcasecmp (key, "LogLevel")) {
                log_level = parse_log_severity(value);
-        if (log_level < 0) {
-            log_level = LOG_INFO;
-            ERROR("log_logstash: invalid loglevel [%s] defaulting to 'info'",
-                  value);
-            return 1;
-        }
+               if (log_level < 0) {
+                       log_level = LOG_INFO;
+                       ERROR("log_logstash: invalid loglevel [%s] defaulting to 'info'",
+                               value);
+                       return 1;
+               }
        }
        else if (0 == strcasecmp (key, "File")) {
                sfree (log_file);
index 949724e..6eb12dd 100644 (file)
@@ -367,28 +367,28 @@ static int init_state = 0;
 static inline int item_watched(int i)
 {
        assert (i >= 0);
-       assert (((size_t) i) < ((STATIC_ARRAY_SIZE (watch_items) + 1) * 32));
+       assert ((size_t) i < (STATIC_ARRAY_SIZE (watch_items) * 32));
        return watch_items[i / 32] & FLAG (i);
 }
 
 static inline int item_summed(int i)
 {
        assert (i >= 0);
-       assert (((size_t) i) < ((STATIC_ARRAY_SIZE (misc_items) + 1) * 32));
+       assert ((size_t) i < (STATIC_ARRAY_SIZE (misc_items) * 32));
        return misc_items[i / 32] & FLAG (i);
 }
 
 static inline void watchlist_add (uint32_t *wl, int item)
 {
        assert (item >= 0);
-       assert (item < ((WL_LEN + 1) * 32));
+       assert (item < WL_LEN * 32);
        wl[item / 32] |= FLAG (item);
 }
 
 static inline void watchlist_remove (uint32_t *wl, int item)
 {
        assert (item >= 0);
-       assert (item < ((WL_LEN + 1) * 32));
+       assert (item < WL_LEN * 32);
        wl[item / 32] &= ~FLAG (item);
 }
 
index 8f99a6d..bff9448 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/match_empty_counter.c
- * Copyright (C) 2009       Florian Forster
+ * Copyright (C) 2009-2016  Florian Forster
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
 
 #include "collectd.h"
 #include "common.h"
-#include "utils_cache.h"
 #include "filter_chain.h"
 
 /*
- * private data types
- */
-struct mec_match_s;
-typedef struct mec_match_s mec_match_t;
-struct mec_match_s
-{
-  int dummy;
-};
-
-/*
  * internal helper functions
  */
 static int mec_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
 {
-  mec_match_t *m;
-
-  m = calloc (1, sizeof (*m));
-  if (m == NULL)
-  {
-    ERROR ("mec_create: calloc failed.");
-    return (-ENOMEM);
-  }
-
   if (ci->children_num != 0)
   {
     ERROR ("empty_counter match: This match does not take any additional "
         "configuration.");
   }
 
-  *user_data = m;
+  *user_data = NULL;
   return (0);
 } /* }}} int mec_create */
 
-static int mec_destroy (void **user_data) /* {{{ */
+static int mec_destroy (__attribute__((unused)) void **user_data) /* {{{ */
 {
-  if (user_data != NULL)
-  {
-    sfree (*user_data);
-  }
-
   return (0);
 } /* }}} int mec_destroy */
 
-static int mec_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */
+static int mec_match (__attribute__((unused)) const data_set_t *ds, /* {{{ */
     const value_list_t *vl,
-    notification_meta_t __attribute__((unused)) **meta, void **user_data)
+    __attribute__((unused)) notification_meta_t **meta,
+    __attribute__((unused)) void **user_data)
 {
-  int num_counters;
-  int num_empty;
+  int num_counters = 0;
+  int num_empty = 0;
   size_t i;
 
-  if ((user_data == NULL) || (*user_data == NULL))
-    return (-1);
-
-
-  num_counters = 0;
-  num_empty = 0;
-
   for (i = 0; i < ds->ds_num; i++)
   {
-    if (ds->ds[i].type != DS_TYPE_COUNTER)
+    if ((ds->ds[i].type != DS_TYPE_DERIVE)
+        && (ds->ds[i].type != DS_TYPE_COUNTER))
       continue;
 
     num_counters++;
-    if (vl->values[i].counter == 0)
+    if (((ds->ds[i].type == DS_TYPE_DERIVE) && (vl->values[i].derive == 0))
+        || ((ds->ds[i].type == DS_TYPE_COUNTER) && (vl->values[i].counter == 0)))
       num_empty++;
   }
 
-  if (num_counters == 0)
-    return (FC_MATCH_NO_MATCH);
-  else if (num_counters == num_empty)
+  if ((num_counters != 0) && (num_counters == num_empty))
     return (FC_MATCH_MATCHES);
-  else
-    return (FC_MATCH_NO_MATCH);
+
+  return (FC_MATCH_NO_MATCH);
 } /* }}} int mec_match */
 
 void module_register (void)
 {
-  match_proc_t mproc;
-
-  memset (&mproc, 0, sizeof (mproc));
-  mproc.create  = mec_create;
-  mproc.destroy = mec_destroy;
-  mproc.match   = mec_match;
-  fc_register_match ("empty_counter", mproc);
+  fc_register_match ("empty_counter", (match_proc_t) {
+    .create  = mec_create,
+    .destroy = mec_destroy,
+    .match   = mec_match,
+  });
 } /* module_register */
 
 /* vim: set sw=2 sts=2 tw=78 et fdm=marker : */
index 4178d75..79f79fa 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "collectd.h"
 #include "common.h"
-#include "utils_cache.h"
 #include "filter_chain.h"
 
 /*
index 77c8f51..750817b 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "collectd.h"
 #include "common.h"
-#include "utils_cache.h"
 #include "filter_chain.h"
 
 #define SATISFY_ALL 0
index 629b99b..d7e6c28 100644 (file)
@@ -271,7 +271,7 @@ static int cmc_config_add_match (web_page_t *page, /* {{{ */
       match->dstype);
   if (match->match == NULL)
   {
-    ERROR ("memcachec plugin: tail_match_add_match_simple failed.");
+    ERROR ("memcachec plugin: match_create_simple failed.");
     cmc_web_match_free (match);
     return (-1);
   }
index 62ac72a..54e3a19 100644 (file)
@@ -52,8 +52,9 @@ typedef struct memcached_s memcached_t;
 
 static _Bool memcached_have_instances = 0;
 
-static void memcached_free (memcached_t *st)
+static void memcached_free (void *arg)
 {
+  memcached_t *st = arg;
   if (st == NULL)
     return;
 
@@ -556,7 +557,7 @@ static int memcached_add_read_callback (memcached_t *st)
 
   memset (&ud, 0, sizeof (ud));
   ud.data = st;
-  ud.free_func = (void *) memcached_free;
+  ud.free_func = memcached_free;
 
   assert (st->name != NULL);
   ssnprintf (callback_name, sizeof (callback_name), "memcached/%s", st->name);
index 51447b1..11b9bf1 100644 (file)
@@ -257,7 +257,7 @@ static int mb_submit (mb_host_t *host, mb_slave_t *slave, /* {{{ */
   if ((host == NULL) || (slave == NULL) || (data == NULL))
     return (EINVAL);
 
-  if (host->interval <= 0)
+  if (host->interval == 0)
     host->interval = plugin_get_interval ();
 
   if (slave->instance[0] == 0)
index dbef915..7516db4 100644 (file)
@@ -33,7 +33,6 @@
 #include "collectd.h"
 #include "common.h"
 #include "plugin.h"
-#include "utils_cache.h"
 #include "utils_complain.h"
 
 #include <mosquitto.h>
index a239413..8ab775f 100644 (file)
@@ -71,7 +71,7 @@ static void mysql_database_free (void *arg) /* {{{ */
 
        DEBUG ("mysql plugin: mysql_database_free (arg = %p);", arg);
 
-       db = (mysql_database_t *) arg;
+       db = arg;
 
        if (db == NULL)
                return;
@@ -904,6 +904,10 @@ static int mysql_read (user_data_t *ud)
                                counter_submit ("mysql_sort", "scan", val, db);
 
                }
+               else if (strncmp (key, "Slow_queries", strlen ("Slow_queries")) == 0) 
+               {
+                       counter_submit ("mysql_slow_queries", NULL , val, db);
+               }
        }
        mysql_free_result (res); res = NULL;
 
index 219f163..4393d08 100644 (file)
@@ -30,7 +30,6 @@
 #include "common.h"
 #include "configfile.h"
 #include "utils_fbhash.h"
-#include "utils_avltree.h"
 #include "utils_cache.h"
 #include "utils_complain.h"
 
@@ -410,10 +409,10 @@ static int network_dispatch_values (value_list_t *vl, /* {{{ */
 {
   int status;
 
-  if ((vl->time <= 0)
-      || (strlen (vl->host) <= 0)
-      || (strlen (vl->plugin) <= 0)
-      || (strlen (vl->type) <= 0))
+  if ((vl->time == 0)
+      || (strlen (vl->host) == 0)
+      || (strlen (vl->plugin) == 0)
+      || (strlen (vl->type) == 0))
     return (-EINVAL);
 
   if (!check_receive_okay (vl))
@@ -494,6 +493,8 @@ static int network_dispatch_notification (notification_t *n) /* {{{ */
 #if HAVE_LIBGCRYPT
 static void network_init_gcrypt (void) /* {{{ */
 {
+  gcry_error_t err;
+
   /* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
    * Because you can't know in a library whether another library has
    * already initialized the library */
@@ -508,10 +509,23 @@ static void network_init_gcrypt (void) /* {{{ */
   *
   * tl;dr: keep all these gry_* statements in this exact order please. */
 # if GCRYPT_VERSION_NUMBER < 0x010600
-  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+  err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+  if (err)
+  {
+    ERROR ("network plugin: gcry_control (GCRYCTL_SET_THREAD_CBS) failed: %s", gcry_strerror (err));
+    abort ();
+  }
 # endif
+
   gcry_check_version (NULL);
-  gcry_control (GCRYCTL_INIT_SECMEM, 32768);
+
+  err = gcry_control (GCRYCTL_INIT_SECMEM, 32768);
+  if (err)
+  {
+    ERROR ("network plugin: gcry_control (GCRYCTL_INIT_SECMEM) failed: %s", gcry_strerror (err));
+    abort ();
+  }
+
   gcry_control (GCRYCTL_INITIALIZATION_FINISHED);
 } /* }}} void network_init_gcrypt */
 
@@ -591,11 +605,11 @@ static gcry_cipher_hd_t network_get_aes256_cypher (sockent_t *se, /* {{{ */
 } /* }}} int network_get_aes256_cypher */
 #endif /* HAVE_LIBGCRYPT */
 
-static int write_part_values (char **ret_buffer, int *ret_buffer_len,
+static int write_part_values (char **ret_buffer, size_t *ret_buffer_len,
                const data_set_t *ds, const value_list_t *vl)
 {
        char *packet_ptr;
-       int packet_len;
+       size_t packet_len;
        int num_values;
 
        part_header_t pkg_ph;
@@ -603,7 +617,7 @@ static int write_part_values (char **ret_buffer, int *ret_buffer_len,
        uint8_t      *pkg_values_types;
        value_t      *pkg_values;
 
-       int offset;
+       size_t offset;
        int i;
 
        num_values = vl->values_len;
@@ -692,16 +706,16 @@ static int write_part_values (char **ret_buffer, int *ret_buffer_len,
        return (0);
 } /* int write_part_values */
 
-static int write_part_number (char **ret_buffer, int *ret_buffer_len,
+static int write_part_number (char **ret_buffer, size_t *ret_buffer_len,
                int type, uint64_t value)
 {
        char *packet_ptr;
-       int packet_len;
+       size_t packet_len;
 
        part_header_t pkg_head;
        uint64_t pkg_value;
 
-       int offset;
+       size_t offset;
 
        packet_len = sizeof (pkg_head) + sizeof (pkg_value);
 
@@ -727,16 +741,16 @@ static int write_part_number (char **ret_buffer, int *ret_buffer_len,
        return (0);
 } /* int write_part_number */
 
-static int write_part_string (char **ret_buffer, int *ret_buffer_len,
-               int type, const char *str, int str_len)
+static int write_part_string (char **ret_buffer, size_t *ret_buffer_len,
+               int type, const char *str, size_t str_len)
 {
        char *buffer;
-       int buffer_len;
+       size_t buffer_len;
 
        uint16_t pkg_type;
        uint16_t pkg_length;
 
-       int offset;
+       size_t offset;
 
        buffer_len = 2 * sizeof (uint16_t) + str_len + 1;
        if (*ret_buffer_len < buffer_len)
@@ -1246,7 +1260,7 @@ static int parse_part_encr_aes256 (sockent_t *se, /* {{{ */
   BUFFER_READ (&username_len, sizeof (username_len));
   username_len = ntohs (username_len);
 
-  if ((username_len <= 0)
+  if ((username_len == 0)
       || (username_len > (part_size - (PART_ENCRYPTION_AES256_SIZE + 1))))
   {
     NOTICE ("network plugin: parse_part_encr_aes256: "
@@ -1439,6 +1453,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
                                printed_ignore_warning = 1;
                        }
                        buffer = ((char *) buffer) + pkg_length;
+                       buffer_size -= (size_t) pkg_length;
                        continue;
                }
 #endif /* HAVE_LIBGCRYPT */
@@ -1466,6 +1481,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
                                printed_ignore_warning = 1;
                        }
                        buffer = ((char *) buffer) + pkg_length;
+                       buffer_size -= (size_t) pkg_length;
                        continue;
                }
 #endif /* HAVE_LIBGCRYPT */
@@ -1577,13 +1593,13 @@ static int parse_packet (sockent_t *se, /* {{{ */
                                                "unknown severity %i.",
                                                n.severity);
                        }
-                       else if (n.time <= 0)
+                       else if (n.time == 0)
                        {
                                INFO ("network plugin: "
                                                "Ignoring notification with "
                                                "time == 0.");
                        }
-                       else if (strlen (n.message) <= 0)
+                       else if (strlen (n.message) == 0)
                        {
                                INFO ("network plugin: "
                                                "Ignoring notification with "
@@ -1607,6 +1623,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
                        DEBUG ("network plugin: parse_packet: Unknown part"
                                        " type: 0x%04hx", pkg_type);
                        buffer = ((char *) buffer) + pkg_length;
+                       buffer_size -= (size_t) pkg_length;
                }
        } /* while (buffer_size > sizeof (part_header_t)) */
 
@@ -2797,7 +2814,7 @@ static void network_send_buffer (char *buffer, size_t buffer_len) /* {{{ */
   } /* for (sending_sockets) */
 } /* }}} void network_send_buffer */
 
-static int add_to_buffer (char *buffer, int buffer_size, /* {{{ */
+static int add_to_buffer (char *buffer, size_t buffer_size, /* {{{ */
                value_list_t *vl_def,
                const data_set_t *ds, const value_list_t *vl)
 {
@@ -3241,10 +3258,10 @@ static int network_config (oconfig_item_t *ci) /* {{{ */
 static int network_notification (const notification_t *n,
     user_data_t __attribute__((unused)) *user_data)
 {
-  char  buffer[network_config_packet_size];
-  char *buffer_ptr = buffer;
-  int   buffer_free = sizeof (buffer);
-  int   status;
+  char   buffer[network_config_packet_size];
+  char  *buffer_ptr = buffer;
+  size_t buffer_free = sizeof (buffer);
+  int    status;
 
   if (!check_send_notify_okay (n))
     return (0);
index 1071d0b..f8f4f04 100644 (file)
 # include <poll.h>
 #endif
 
+#ifndef STA_NANO
+# define STA_NANO 0x2000
+#endif
+
 static const char *config_keys[] =
 {
        "Host",
@@ -505,7 +509,7 @@ static int ntpd_receive_response (int *res_items, int *res_size,
                        break;
                }
 
-               memset ((void *) &res, '\0', sizeof (res));
+               memset (&res, '\0', sizeof (res));
                status = recv (sd, (void *) &res, sizeof (res), 0 /* no flags */);
 
                if ((status < 0) && ((errno == EAGAIN) || (errno == EINTR)))
@@ -720,7 +724,7 @@ static int ntpd_send_request (int req_code, int req_items, int req_size, char *r
        if ((sd = ntpd_connect ()) < 0)
                return (-1);
 
-       memset ((void *) &req, '\0', sizeof (req));
+       memset (&req, '\0', sizeof (req));
        req.rm_vn_mode = RM_VN_MODE(0, 0, 0);
        req.auth_seq   = AUTH_SEQ (0, 0);
        req.implementation = IMPL_XNTPD;
@@ -910,8 +914,7 @@ static int ntpd_read (void)
        int i;
 
        /* On Linux, if the STA_NANO bit is set in ik->status, then ik->offset
-        * is is nanoseconds, otherwise it's microseconds.
-        * TODO(octo): STA_NANO is defined in the Linux specific <sys/timex.h> header. */
+        * is is nanoseconds, otherwise it's microseconds. */
        double scale_loop  = 1e-6;
        double scale_error = 1e-6;
 
@@ -936,6 +939,11 @@ static int ntpd_read (void)
                return (-1);
        }
 
+       if (ntohs(ik->status) & STA_NANO) {
+               scale_loop  = 1e-9;
+               scale_error = 1e-9;
+       }
+
        /* kerninfo -> estimated error */
        offset_loop  = scale_loop * ((gauge_t) ntohl (ik->offset));
        freq_loop    = ntpd_read_fp (ik->freq);
index 615aee3..151d25d 100644 (file)
@@ -624,9 +624,8 @@ static int cldap_config_add (oconfig_item_t *ci) /* {{{ */
        if ((status == 0) && (st->url != NULL))
        {
                LDAPURLDesc *ludpp;
-               int rc;
 
-               if ((rc = ldap_url_parse (st->url, &ludpp)) != 0)
+               if (ldap_url_parse (st->url, &ludpp) != 0)
                {
                        ERROR ("openldap plugin: Instance `%s': "
                                "Invalid URL: `%s'",
index 5bacd5b..f029a6c 100644 (file)
@@ -366,29 +366,25 @@ static int ps_list_match (const char *name, const char *cmdline, procstat_t *ps)
        return (0);
 } /* int ps_list_match */
 
-static void ps_update_counter (
-        _Bool init,
-        derive_t *group_counter,
-        derive_t *curr_counter, unsigned long *curr_value,
-        derive_t new_counter, unsigned long new_value) {
-    if (init)
-    {
-        *curr_value = new_value;
-        *curr_counter += new_value;
-        *group_counter += new_value;
-        return;
-    }
-
-    if (new_counter < *curr_counter)
-    {
-        *curr_value = new_counter + (ULONG_MAX - *curr_counter);
-    }
-    else
-    {
-        *curr_value = new_counter - *curr_counter;
-    }
-    *curr_counter = new_counter;
-    *group_counter += *curr_value;
+static void ps_update_counter (_Bool init, derive_t *group_counter,
+                               derive_t *curr_counter, unsigned long *curr_value,
+                               derive_t new_counter, unsigned long new_value)
+{
+       if (init)
+       {
+               *curr_value = new_value;
+               *curr_counter += new_value;
+               *group_counter += new_value;
+               return;
+       }
+
+       if (new_counter < *curr_counter)
+               *curr_value = new_counter + (ULONG_MAX - *curr_counter);
+       else
+               *curr_value = new_counter - *curr_counter;
+
+       *curr_counter = new_counter;
+       *group_counter += *curr_value;
 }
 
 /* add process entry to 'instances' of process 'name' (or refresh it) */
@@ -402,7 +398,7 @@ static void ps_list_add (const char *name, const char *cmdline, procstat_entry_t
 
        for (ps = list_head_g; ps != NULL; ps = ps->next)
        {
-        _Bool want_init;
+               _Bool want_init;
 
                if ((ps_list_match (name, cmdline, ps)) == 0)
                        continue;
@@ -882,8 +878,8 @@ static procstat_t *ps_read_tasks_status (long pid, procstat_t *ps)
                if (fclose (fh))
                {
                        char errbuf[1024];
-                               WARNING ("processes: fclose: %s",
-                                       sstrerror (errno, errbuf, sizeof (errbuf)));
+                       WARNING ("processes: fclose: %s",
+                               sstrerror (errno, errbuf, sizeof (errbuf)));
                }
        }
        closedir (dh);
index 0814126..2d0bd95 100644 (file)
@@ -430,6 +430,7 @@ static int redis_read (void) /* {{{ */
     redis_handle_info (rn->name, rr->str, "volatile_changes", NULL, "changes_since_last_save", DS_TYPE_GAUGE);
     redis_handle_info (rn->name, rr->str, "total_connections", NULL, "total_connections_received", DS_TYPE_DERIVE);
     redis_handle_info (rn->name, rr->str, "total_operations", NULL, "total_commands_processed", DS_TYPE_DERIVE);
+    redis_handle_info (rn->name, rr->str, "operations_per_second", NULL, "instantaneous_ops_per_sec", DS_TYPE_GAUGE);
     redis_handle_info (rn->name, rr->str, "expired_keys", NULL, "expired_keys", DS_TYPE_DERIVE);
     redis_handle_info (rn->name, rr->str, "evicted_keys", NULL, "evicted_keys", DS_TYPE_DERIVE);
     redis_handle_info (rn->name, rr->str, "pubsub", "channels", "pubsub_channels", DS_TYPE_GAUGE);
index 21b01d9..348f287 100644 (file)
@@ -688,7 +688,7 @@ static int64_t rrd_get_random_variation (void)
   long min;
   long max;
 
-  if (random_timeout <= 0)
+  if (random_timeout == 0)
     return (0);
 
   /* Assure that "cache_timeout + random_variation" is never negative. */
index 7b39aae..33b9751 100644 (file)
 static const char *config_keys[] =
 {
   "Disk",
-  "IgnoreSelected"
+  "IgnoreSelected",
+  "IgnoreSleepMode",
+  "UseSerial"
 };
 
 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
 
 static ignorelist_t *ignorelist = NULL;
+static int ignore_sleep_mode = 0;
+static int use_serial = 0;
 
 static int smart_config (const char *key, const char *value)
 {
@@ -60,6 +64,16 @@ static int smart_config (const char *key, const char *value)
       invert = 0;
     ignorelist_set_invert (ignorelist, invert);
   }
+  else if (strcasecmp ("IgnoreSleepMode", key) == 0)
+  {
+    if (IS_TRUE (value))
+      ignore_sleep_mode = 1;
+  }
+  else if (strcasecmp ("UseSerial", key) == 0)
+  {
+    if (IS_TRUE (value))
+      use_serial = 1;
+  }
   else
   {
     return (-1);
@@ -130,7 +144,7 @@ static void smart_handle_disk_attribute(SkDisk *d, const SkSmartAttributeParsedD
   }
 }
 
-static void smart_handle_disk (const char *dev)
+static void smart_handle_disk (const char *dev, const char *serial)
 {
   SkDisk *d = NULL;
   SkBool awake = FALSE;
@@ -139,9 +153,16 @@ static void smart_handle_disk (const char *dev)
   const SkSmartParsedData *spd;
   uint64_t poweron, powercycles, badsectors, temperature;
 
-  shortname = strrchr(dev, '/');
-  if (!shortname) return;
-  shortname++;
+  if (use_serial && serial)
+  {
+    shortname = serial;
+  }
+  else
+  {
+    shortname = strrchr(dev, '/');
+    if (!shortname) return;
+    shortname++;
+  }
   if (ignorelist_match (ignorelist, shortname) != 0) {
     DEBUG ("smart plugin: ignoring %s.", dev);
     return;
@@ -165,10 +186,13 @@ static void smart_handle_disk (const char *dev)
     DEBUG ("smart plugin: disk %s has no SMART support.", dev);
     goto end;
   }
-  if (sk_disk_check_sleep_mode (d, &awake) < 0 || !awake)
+  if (!ignore_sleep_mode)
   {
-    DEBUG ("smart plugin: disk %s is sleeping.", dev);
-    goto end;
+    if (sk_disk_check_sleep_mode (d, &awake) < 0 || !awake)
+    {
+      DEBUG ("smart plugin: disk %s is sleeping.", dev);
+      goto end;
+    }
   }
   if (sk_disk_smart_read_data (d) < 0)
   {
@@ -247,13 +271,14 @@ static int smart_read (void)
   devices = udev_enumerate_get_list_entry (enumerate);
   udev_list_entry_foreach (dev_list_entry, devices)
   {
-    const char *path, *devpath;
+    const char *path, *devpath, *serial;
     path = udev_list_entry_get_name (dev_list_entry);
     dev = udev_device_new_from_syspath (handle_udev, path);
     devpath = udev_device_get_devnode (dev);
+    serial = udev_device_get_property_value (dev, "ID_SERIAL");
 
     /* Query status with libatasmart */
-    smart_handle_disk (devpath);
+    smart_handle_disk (devpath, serial);
     udev_device_unref (dev);
   }
 
index 1819b3e..a0c6e4f 100644 (file)
@@ -29,7 +29,6 @@
 #include "common.h"
 #include "configfile.h"
 #include "utils_avltree.h"
-#include "utils_complain.h"
 #include "utils_latency.h"
 
 #include <sys/types.h>
@@ -356,7 +355,7 @@ static int statsd_handle_set (char const *name, /* {{{ */
 
   /* Make sure metric->set exists. */
   if (metric->set == NULL)
-    metric->set = c_avl_create ((void *) strcmp);
+    metric->set = c_avl_create ((int (*) (const void *, const void *)) strcmp);
 
   if (metric->set == NULL)
   {
@@ -710,7 +709,7 @@ static int statsd_init (void) /* {{{ */
 {
   pthread_mutex_lock (&metrics_lock);
   if (metrics_tree == NULL)
-    metrics_tree = c_avl_create ((void *) strcmp);
+    metrics_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
 
   if (!network_thread_running)
   {
index 41f58e5..638109c 100644 (file)
@@ -723,7 +723,7 @@ static int tss2_config (const char *key, const char *value)
        /*
         * Interpret configuration values
         */
-    if (strcasecmp ("Host", key) == 0)
+       if (strcasecmp ("Host", key) == 0)
        {
                char *temp;
 
@@ -806,7 +806,7 @@ static int tss2_read (void)
 
        if (success == 0)
                return (-1);
-    return (0);
+       return (0);
 } /* int tss2_read */
 
 static int tss2_shutdown(void)
index 37ab85d..186cf2b 100644 (file)
--- a/src/ted.c
+++ b/src/ted.c
@@ -70,7 +70,7 @@ static int ted_read_value(double *ret_power, double *ret_voltage)
 {
     unsigned char receive_buffer[300];
     unsigned char package_buffer[300];
-    char pkt_request[1] = {0xAA};
+    unsigned char pkt_request[1] = {0xAA};
     int package_buffer_pos;
 
     fd_set input;
index 94a4f02..77ba3f3 100644 (file)
@@ -30,8 +30,6 @@
 #include "utils_cache.h"
 #include "utils_threshold.h"
 
-#include <assert.h>
-
 /*
  * Threshold management
  * ====================
@@ -876,7 +874,7 @@ static int ut_config (oconfig_item_t *ci)
 
   if (threshold_tree == NULL)
   {
-    threshold_tree = c_avl_create ((void *) strcmp);
+    threshold_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
     if (threshold_tree == NULL)
     {
       ERROR ("ut_config: c_avl_create failed.");
index e328a46..8c6a995 100644 (file)
@@ -140,6 +140,7 @@ mysql_select            value:DERIVE:0:U
 mysql_sort              value:DERIVE:0:U
 mysql_sort_merge_passes value:DERIVE:0:U
 mysql_sort_rows         value:DERIVE:0:U
+mysql_slow_queries      value:DERIVE:0:U
 nfs_procedure           value:DERIVE:0:U
 nginx_connections       value:GAUGE:0:U
 nginx_requests          value:DERIVE:0:U
@@ -149,6 +150,7 @@ node_stat               value:DERIVE:0:U
 node_tx_rate            value:GAUGE:0:127
 objects                 value:GAUGE:0:U
 operations              value:DERIVE:0:U
+operations_per_second   value:GAUGE:0:U
 packets                 value:DERIVE:0:U
 pending_operations      value:GAUGE:0:U
 percent                 value:GAUGE:0:100.1
index 009ab3d..4c40e55 100644 (file)
@@ -218,8 +218,8 @@ int handle_putval (FILE *fh, char *buffer)
        } /* while (*buffer != 0) */
        /* Done parsing the options. */
 
-    if (fh!=stdout)
-           print_to_socket (fh, "0 Success: %i %s been dispatched.\n",
+       if (fh!=stdout)
+               print_to_socket (fh, "0 Success: %i %s been dispatched.\n",
                        values_submitted,
                        (values_submitted == 1) ? "value has" : "values have");
 
index ff2eb64..258c5cf 100644 (file)
@@ -164,7 +164,7 @@ curl_stats_t *curl_stats_from_config (oconfig_item_t *ci)
        if (ci == NULL)
                return NULL;
 
-       s = calloc (sizeof (*s), 1);
+       s = calloc (1, sizeof (*s));
        if (s == NULL)
                return NULL;
 
index 991d346..a1e4222 100644 (file)
@@ -283,8 +283,7 @@ void dnstop_set_callback (void (*cb) (const rfc1035_header_t *))
 
 #define RFC1035_MAXLABELSZ 63
 static int
-rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns
-)
+rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns)
 {
     off_t no = 0;
     unsigned char c;
@@ -292,7 +291,7 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns
     static int loop_detect = 0;
     if (loop_detect > 2)
        return 4;               /* compression loop */
-    if (ns <= 0)
+    if (ns == 0)
        return 4;               /* probably compression loop */
     do {
        if ((*off) >= ((off_t) sz))
@@ -324,7 +323,6 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns
             * "(The 10 and 01 combinations are reserved for future use.)"
             */
            return 3;           /* reserved label/compression flags */
-           break;
        } else {
            (*off)++;
            len = (size_t) c;
@@ -830,9 +828,7 @@ const char *qtype_str(int t)
            default:
                    ssnprintf (buf, sizeof (buf), "#%i", t);
                    return (buf);
-    }; /* switch (t) */
-    /* NOTREACHED */
-    return (NULL);
+    } /* switch (t) */
 }
 
 const char *opcode_str (int o)
@@ -841,24 +837,18 @@ const char *opcode_str (int o)
     switch (o) {
     case 0:
        return "Query";
-       break;
     case 1:
        return "Iquery";
-       break;
     case 2:
        return "Status";
-       break;
     case 4:
        return "Notify";
-       break;
     case 5:
        return "Update";
-       break;
     default:
        ssnprintf(buf, sizeof (buf), "Opcode%d", o);
        return buf;
     }
-    /* NOTREACHED */
 }
 
 const char *rcode_str (int rcode)
@@ -902,8 +892,6 @@ const char *rcode_str (int rcode)
                        ssnprintf (buf, sizeof (buf), "RCode%i", rcode);
                        return (buf);
        }
-       /* Never reached */
-       return (NULL);
 } /* const char *rcode_str (int rcode) */
 
 #if 0
index f27c082..d1a580c 100644 (file)
@@ -27,8 +27,6 @@
 #include "collectd.h"
 #include "plugin.h"
 
-#include <pthread.h>
-
 #include "utils_fbhash.h"
 #include "utils_avltree.h"
 
@@ -93,7 +91,7 @@ static int fbh_read_file (fbhash_t *h) /* {{{ */
     return (-1);
   }
 
-  tree = c_avl_create ((void *) strcmp);
+  tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
   if (tree == NULL)
   {
     fclose (fh);
diff --git a/src/utils_format_kairosdb.c b/src/utils_format_kairosdb.c
new file mode 100644 (file)
index 0000000..6258c49
--- /dev/null
@@ -0,0 +1,379 @@
+/**
+ * collectd - src/utils_format_kairosdb.c
+ * Copyright (C) 2016       Aurelien beorn Rougemont
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *   Aurelien beorn Rougemont <beorn at gandi dot net>
+ **/
+
+
+#include "collectd.h"
+#include "plugin.h"
+#include "common.h"
+
+#include "utils_cache.h"
+#include "utils_format_kairosdb.h"
+
+
+/* This is the KAIROSDB format for write_http output
+ *
+ * Target format
+ * [
+ *   {
+ *     "name":"collectd.vmem"
+ *     "datapoints":
+ *       [
+ *         [1453897164060, 97.000000]
+ *       ],
+ *      "tags":
+ *        {
+ *          "host": "fqdn.domain.tld",
+ *          "plugin_instance": "vmpage_number",
+ *          "type": "kernel_stack",
+ *          "ds": "value"
+ *          ""
+ *        }
+ *   }
+ * ]
+ */
+
+static int kairosdb_escape_string (char *buffer, size_t buffer_size, /* {{{ */
+    const char *string)
+{
+  size_t src_pos;
+  size_t dst_pos;
+
+  if ((buffer == NULL) || (string == NULL))
+    return (-EINVAL);
+
+  if (buffer_size < 3)
+    return (-ENOMEM);
+
+  dst_pos = 0;
+
+#define BUFFER_ADD(c) do { \
+  if (dst_pos >= (buffer_size - 1)) { \
+    buffer[buffer_size - 1] = 0; \
+    return (-ENOMEM); \
+  } \
+  buffer[dst_pos] = (c); \
+  dst_pos++; \
+} while (0)
+
+  /* Escape special characters */
+  /* authorize -_. and alpha num but also escapes " */
+  BUFFER_ADD ('"');
+  for (src_pos = 0; string[src_pos] != 0; src_pos++)
+  {
+    if (isalnum(string[src_pos]) ||
+      0x2d == string[src_pos] ||
+      0x2e == string[src_pos] ||
+      0x5f == string[src_pos])
+        BUFFER_ADD (tolower(string[src_pos]));
+  } /* for */
+  BUFFER_ADD ('"');
+  buffer[dst_pos] = 0;
+
+#undef BUFFER_ADD
+
+  return (0);
+} /* }}} int kairosdb_escape_string */
+
+static int values_to_kairosdb (char *buffer, size_t buffer_size, /* {{{ */
+                const data_set_t *ds, const value_list_t *vl, int store_rates,
+                size_t ds_idx)
+{
+  size_t offset = 0;
+  gauge_t *rates = NULL;
+
+  memset (buffer, 0, buffer_size);
+
+#define BUFFER_ADD(...) do { \
+  int status; \
+  status = ssnprintf (buffer + offset, buffer_size - offset, \
+      __VA_ARGS__); \
+  if (status < 1) \
+  { \
+    sfree(rates); \
+    return (-1); \
+  } \
+  else if (((size_t) status) >= (buffer_size - offset)) \
+  { \
+    sfree(rates); \
+    return (-ENOMEM); \
+  } \
+  else \
+    offset += ((size_t) status); \
+} while (0)
+
+  if (ds->ds[ds_idx].type == DS_TYPE_GAUGE)
+  {
+    if (isfinite (vl->values[ds_idx].gauge))
+    {
+      BUFFER_ADD ("[[");
+      BUFFER_ADD ("%"PRIu64, CDTIME_T_TO_MS (vl->time));
+      BUFFER_ADD (",");
+      BUFFER_ADD (JSON_GAUGE_FORMAT, vl->values[ds_idx].gauge);
+    }
+    else
+    {
+      DEBUG ("utils_format_kairosdb: invalid vl->values[ds_idx].gauge for %s|%s|%s|%s|%s",
+                vl->plugin,
+                vl->plugin_instance,
+                vl->type,
+                vl->type_instance,
+                ds->ds[ds_idx].name);
+      return (-1);
+    }
+  }
+  else if (store_rates)
+  {
+    if (rates == NULL)
+      rates = uc_get_rate (ds, vl);
+    if (rates == NULL)
+    {
+      WARNING ("utils_format_kairosdb: uc_get_rate failed for %s|%s|%s|%s|%s",
+                vl->plugin,
+                vl->plugin_instance,
+                vl->type,
+                vl->type_instance,
+                ds->ds[ds_idx].name);
+
+      return (-1);
+    }
+
+    if (isfinite (rates[ds_idx]))
+    {
+      BUFFER_ADD ("[[");
+      BUFFER_ADD ("%"PRIu64, CDTIME_T_TO_MS (vl->time));
+      BUFFER_ADD (",");
+      BUFFER_ADD (JSON_GAUGE_FORMAT, rates[ds_idx]);
+    }
+    else
+    {
+      WARNING ("utils_format_kairosdb: invalid rates[ds_idx] for %s|%s|%s|%s|%s",
+                vl->plugin,
+                vl->plugin_instance,
+                vl->type,
+                vl->type_instance,
+                ds->ds[ds_idx].name);
+      sfree(rates);
+      return (-1);
+    }
+  }
+  else if (ds->ds[ds_idx].type == DS_TYPE_COUNTER)
+  {
+    BUFFER_ADD ("[[");
+    BUFFER_ADD ("%"PRIu64, CDTIME_T_TO_MS (vl->time));
+    BUFFER_ADD (",");
+    BUFFER_ADD ("%llu", vl->values[ds_idx].counter);
+  }
+  else if (ds->ds[ds_idx].type == DS_TYPE_DERIVE)
+  {
+    BUFFER_ADD ("[[");
+    BUFFER_ADD ("%"PRIu64, CDTIME_T_TO_MS (vl->time));
+    BUFFER_ADD (",");
+    BUFFER_ADD ("%"PRIi64, vl->values[ds_idx].derive);
+  }
+  else if (ds->ds[ds_idx].type == DS_TYPE_ABSOLUTE)
+  {
+    BUFFER_ADD ("[[");
+    BUFFER_ADD ("%"PRIu64, CDTIME_T_TO_MS (vl->time));
+    BUFFER_ADD (",");
+    BUFFER_ADD ("%"PRIu64, vl->values[ds_idx].absolute);
+  }
+  else
+  {
+    ERROR ("format_kairosdb: Unknown data source type: %i",
+        ds->ds[ds_idx].type);
+    sfree (rates);
+    return (-1);
+  }
+  BUFFER_ADD ("]]");
+
+#undef BUFFER_ADD
+
+  DEBUG ("format_kairosdb: values_to_kairosdb: buffer = %s;", buffer);
+  sfree(rates);
+  return (0);
+} /* }}} int values_to_kairosdb */
+
+static int value_list_to_kairosdb (char *buffer, size_t buffer_size, /* {{{ */
+                const data_set_t *ds, const value_list_t *vl, int store_rates)
+{
+  char temp[512];
+  size_t offset = 0;
+  int status;
+  size_t i;
+
+  memset (buffer, 0, buffer_size);
+
+#define BUFFER_ADD(...) do { \
+  status = ssnprintf (buffer + offset, buffer_size - offset, \
+      __VA_ARGS__); \
+  if (status < 1) \
+    return (-1); \
+  else if (((size_t) status) >= (buffer_size - offset)) \
+    return (-ENOMEM); \
+  else \
+    offset += ((size_t) status); \
+} while (0)
+
+#define BUFFER_ADD_KEYVAL(key, value) do { \
+  status = kairosdb_escape_string (temp, sizeof (temp), (value)); \
+  if (status != 0) \
+    return (status); \
+  BUFFER_ADD (",\"%s\": %s", (key), temp); \
+} while (0)
+
+  for (i = 0; i < ds->ds_num; i++)
+  {
+    /* All value lists have a leading comma. The first one will be replaced with
+     * a square bracket in `format_kairosdb_finalize'. */
+    BUFFER_ADD (",{");
+
+    BUFFER_ADD ("\"name\":\"collectd");
+
+    BUFFER_ADD (".%s", vl->plugin);
+
+    status = values_to_kairosdb (temp, sizeof (temp), ds, vl, store_rates, i);
+    if (status != 0)
+      return (status);
+
+    BUFFER_ADD ("\", \"datapoints\": %s", temp);
+
+    /*
+     * Now adds meta data to metric as tags
+     */
+
+    memset (temp, 0, sizeof(temp));
+
+    BUFFER_ADD (", \"tags\":\{");
+
+    BUFFER_ADD ("\"host\": \"%s\"", vl->host);
+    if (strlen(vl->plugin_instance))
+      BUFFER_ADD_KEYVAL ("plugin_instance", vl->plugin_instance);
+    BUFFER_ADD_KEYVAL ("type", vl->type);
+    if (strlen(vl->type_instance))
+      BUFFER_ADD_KEYVAL ("type_instance", vl->type_instance);
+    if (ds->ds_num != 1)
+      BUFFER_ADD_KEYVAL ("ds", ds->ds[i].name);
+    BUFFER_ADD ("}}");
+  } /* for ds->ds_num */
+
+#undef BUFFER_ADD_KEYVAL
+#undef BUFFER_ADD
+
+  DEBUG ("format_kairosdb: value_list_to_kairosdb: buffer = %s;", buffer);
+
+  return (0);
+} /* }}} int value_list_to_kairosdb */
+
+static int format_kairosdb_value_list_nocheck (char *buffer, /* {{{ */
+    size_t *ret_buffer_fill, size_t *ret_buffer_free,
+    const data_set_t *ds, const value_list_t *vl,
+    int store_rates, size_t temp_size)
+{
+  char temp[temp_size];
+  int status;
+
+  status = value_list_to_kairosdb (temp, sizeof (temp), ds, vl, store_rates);
+  if (status != 0)
+    return (status);
+  temp_size = strlen (temp);
+
+  memcpy (buffer + (*ret_buffer_fill), temp, temp_size + 1);
+  (*ret_buffer_fill) += temp_size;
+  (*ret_buffer_free) -= temp_size;
+
+  return (0);
+} /* }}} int format_kairosdb_value_list_nocheck */
+
+int format_kairosdb_initialize (char *buffer, /* {{{ */
+    size_t *ret_buffer_fill, size_t *ret_buffer_free)
+{
+  size_t buffer_fill;
+  size_t buffer_free;
+
+  if ((buffer == NULL) || (ret_buffer_fill == NULL) || (ret_buffer_free == NULL))
+    return (-EINVAL);
+
+  buffer_fill = *ret_buffer_fill;
+  buffer_free = *ret_buffer_free;
+
+  buffer_free = buffer_fill + buffer_free;
+  buffer_fill = 0;
+
+  if (buffer_free < 3)
+    return (-ENOMEM);
+
+  memset (buffer, 0, buffer_free);
+  *ret_buffer_fill = buffer_fill;
+  *ret_buffer_free = buffer_free;
+
+  return (0);
+} /* }}} int format_kairosdb_initialize */
+
+int format_kairosdb_finalize (char *buffer, /* {{{ */
+    size_t *ret_buffer_fill, size_t *ret_buffer_free)
+{
+  size_t pos;
+
+  if ((buffer == NULL) || (ret_buffer_fill == NULL) || (ret_buffer_free == NULL))
+    return (-EINVAL);
+
+  if (*ret_buffer_free < 2)
+    return (-ENOMEM);
+
+  /* Replace the leading comma added in `value_list_to_kairosdb' with a square
+   * bracket. */
+  if (buffer[0] != ',')
+    return (-EINVAL);
+  buffer[0] = '[';
+
+  pos = *ret_buffer_fill;
+  buffer[pos] = ']';
+  buffer[pos+1] = 0;
+
+  (*ret_buffer_fill)++;
+  (*ret_buffer_free)--;
+
+  return (0);
+} /* }}} int format_kairosdb_finalize */
+
+int format_kairosdb_value_list (char *buffer, /* {{{ */
+    size_t *ret_buffer_fill, size_t *ret_buffer_free,
+    const data_set_t *ds, const value_list_t *vl, int store_rates)
+{
+  if ((buffer == NULL)
+      || (ret_buffer_fill == NULL) || (ret_buffer_free == NULL)
+      || (ds == NULL) || (vl == NULL))
+    return (-EINVAL);
+
+  if (*ret_buffer_free < 3)
+    return (-ENOMEM);
+
+  return (format_kairosdb_value_list_nocheck (buffer,
+        ret_buffer_fill, ret_buffer_free, ds, vl,
+        store_rates, (*ret_buffer_free) - 2));
+} /* }}} int format_kairosdb_value_list */
+
+/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/utils_format_kairosdb.h b/src/utils_format_kairosdb.h
new file mode 100644 (file)
index 0000000..23cc862
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * collectd - src/utils_format_kairosdb.h
+ * Copyright (C) 2016       Aurelien Rougemont
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *   Aurelien beorn Rougemont <beorn at gandi dot net>
+ **/
+
+#ifndef UTILS_FORMAT_KAIROSDB_H
+#define UTILS_FORMAT_KAIROSDB_H 1
+
+#include "collectd.h"
+#include "plugin.h"
+
+#ifndef JSON_GAUGE_FORMAT
+# define JSON_GAUGE_FORMAT GAUGE_FORMAT
+#endif
+
+int format_kairosdb_initialize (char *buffer,
+    size_t *ret_buffer_fill, size_t *ret_buffer_free);
+int format_kairosdb_value_list (char *buffer,
+    size_t *ret_buffer_fill, size_t *ret_buffer_free,
+    const data_set_t *ds, const value_list_t *vl, int store_rates);
+int format_kairosdb_finalize (char *buffer,
+    size_t *ret_buffer_fill, size_t *ret_buffer_free);
+
+#endif /* UTILS_FORMAT_KAIROSDB_H */
index 69da040..f3ec71a 100644 (file)
@@ -25,8 +25,6 @@
  **/
 
 #include "collectd.h"
-#include "common.h"
-#include "plugin.h"
 #include "utils_parse_option.h"
 
 int parse_string (char **ret_buffer, char **ret_string)
index 8a2e567..6081c90 100644 (file)
@@ -381,7 +381,7 @@ static by_type_entry_t *lu_search_by_type (lookup_t *obj, /* {{{ */
   }
   by_type->wildcard_plugin_list = NULL;
 
-  by_type->by_plugin_tree = c_avl_create ((void *) strcmp);
+  by_type->by_plugin_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
   if (by_type->by_plugin_tree == NULL)
   {
     ERROR ("utils_vl_lookup: c_avl_create failed.");
@@ -564,7 +564,7 @@ lookup_t *lookup_create (lookup_class_callback_t cb_user_class, /* {{{ */
     return (NULL);
   }
 
-  obj->by_type_tree = c_avl_create ((void *) strcmp);
+  obj->by_type_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
   if (obj->by_type_tree == NULL)
   {
     ERROR ("utils_vl_lookup: c_avl_create failed.");
index 5088217..3836e52 100644 (file)
@@ -28,7 +28,7 @@
 #include "configfile.h"
 #include "plugin.h"
 
-#if HAVE_LIBHAL
+#if HAVE_LIBHAL_H
 #include <libhal.h>
 #endif
 
@@ -107,7 +107,7 @@ uuid_get_from_dmidecode(void)
     return uuid;
 }
 
-#if HAVE_LIBHAL
+#if HAVE_LIBHAL_H
 
 #define UUID_PATH "/org/freedesktop/Hal/devices/computer"
 #define UUID_PROPERTY "smbios.system.uuid"
@@ -199,7 +199,7 @@ uuid_get_local(void)
         return uuid;
     }
 
-#if HAVE_LIBHAL
+#if HAVE_LIBHAL_H
     if ((uuid = uuid_get_from_hal()) != NULL) {
         return uuid;
     }
index d7da95a..771d4a4 100644 (file)
@@ -1014,9 +1014,11 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */
                        cf_util_get_boolean (child, &conf->collect_connections);
                else if (strcasecmp ("CollectESI", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_esi);
-#ifdef HAVE_VARNISH_V3
                else if (strcasecmp ("CollectDirectorDNS", child->key) == 0)
+#ifdef HAVE_VARNISH_V3
                        cf_util_get_boolean (child, &conf->collect_dirdns);
+#else
+                       WARNING ("Varnish plugin: \"%s\" is available for Varnish %s only.", child->key, "v3");
 #endif
                else if (strcasecmp ("CollectBackend", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_backend);
@@ -1026,11 +1028,16 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */
                        cf_util_get_boolean (child, &conf->collect_hcb);
                else if (strcasecmp ("CollectObjects", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_objects);
-#if HAVE_VARNISH_V2
                else if (strcasecmp ("CollectPurge", child->key) == 0)
+#if HAVE_VARNISH_V2
                        cf_util_get_boolean (child, &conf->collect_purge);
 #else
+                       WARNING ("Varnish plugin: \"%s\" is available for Varnish %s only.", child->key, "v2");
+#endif
                else if (strcasecmp ("CollectBan", child->key) == 0)
+#if HAVE_VARNISH_V2
+                       WARNING ("Varnish plugin: \"%s\" is not available for Varnish %s.", child->key, "v2");
+#else
                        cf_util_get_boolean (child, &conf->collect_ban);
 #endif
                else if (strcasecmp ("CollectSession", child->key) == 0)
@@ -1039,27 +1046,37 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */
                        cf_util_get_boolean (child, &conf->collect_shm);
                else if (strcasecmp ("CollectSMS", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_sms);
-#if HAVE_VARNISH_V2
                else if (strcasecmp ("CollectSMA", child->key) == 0)
+#if HAVE_VARNISH_V2
                        cf_util_get_boolean (child, &conf->collect_sma);
+#else
+                       WARNING ("Varnish plugin: \"%s\" is available for Varnish %s only.", child->key, "v2");
+#endif
                else if (strcasecmp ("CollectSM", child->key) == 0)
+#if HAVE_VARNISH_V2
                        cf_util_get_boolean (child, &conf->collect_sm);
+#else
+                       WARNING ("Varnish plugin: \"%s\" is available for Varnish %s only.", child->key, "v2");
 #endif
                else if (strcasecmp ("CollectStruct", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_struct);
                else if (strcasecmp ("CollectTotals", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_totals);
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
                else if (strcasecmp ("CollectUptime", child->key) == 0)
+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
                        cf_util_get_boolean (child, &conf->collect_uptime);
+#else
+                       WARNING ("Varnish plugin: \"%s\" is available for Varnish %s only.", child->key, "v3 and v4");
 #endif
                else if (strcasecmp ("CollectVCL", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_vcl);
                else if (strcasecmp ("CollectWorkers", child->key) == 0)
                        cf_util_get_boolean (child, &conf->collect_workers);
-#if HAVE_VARNISH_V4
                else if (strcasecmp ("CollectVSM", child->key) == 0)
+#if HAVE_VARNISH_V4
                        cf_util_get_boolean (child, &conf->collect_vsm);
+#else
+                       WARNING ("Varnish plugin: \"%s\" is available for Varnish %s only.", child->key, "v4");
 #endif
                else
                {
index e5a8725..16bb77b 100644 (file)
@@ -587,7 +587,7 @@ lv_read (void)
             continue;
         }
 
-        status =  virDomainMemoryStats (domains[i], minfo, VIR_DOMAIN_MEMORY_STAT_NR, 0);
+        status = virDomainMemoryStats (domains[i], minfo, VIR_DOMAIN_MEMORY_STAT_NR, 0);
 
         if (status < 0) {
             ERROR ("virt plugin: virDomainMemoryStats failed with status %i.",
index 0f9a8be..64794be 100644 (file)
@@ -47,7 +47,6 @@
 #include "plugin.h"
 #include "configfile.h"
 
-#include "utils_cache.h"
 #include "utils_complain.h"
 #include "utils_format_graphite.h"
 
index 779c94f..2d8e553 100644 (file)
@@ -26,8 +26,8 @@
 #include "collectd.h"
 #include "plugin.h"
 #include "common.h"
-#include "utils_cache.h"
 #include "utils_format_json.h"
+#include "utils_format_kairosdb.h"
 
 #include <curl/curl.h>
 
@@ -60,8 +60,9 @@ struct wh_callback_s
         time_t low_speed_time;
         int timeout;
 
-#define WH_FORMAT_COMMAND 0
-#define WH_FORMAT_JSON    1
+#define WH_FORMAT_COMMAND  0
+#define WH_FORMAT_JSON     1
+#define WH_FORMAT_KAIROSDB 2
         int format;
 
         CURL *curl;
@@ -98,7 +99,7 @@ static void wh_reset_buffer (wh_callback_t *cb)  /* {{{ */
         cb->send_buffer_fill = 0;
         cb->send_buffer_init_time = cdtime ();
 
-        if (cb->format == WH_FORMAT_JSON)
+        if (cb->format == WH_FORMAT_JSON || cb->format == WH_FORMAT_KAIROSDB)
         {
                 format_json_initialize (cb->send_buffer,
                                 &cb->send_buffer_fill,
@@ -153,7 +154,7 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */
         curl_easy_setopt (cb->curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT);
 
         cb->headers = curl_slist_append (cb->headers, "Accept:  */*");
-        if (cb->format == WH_FORMAT_JSON)
+        if (cb->format == WH_FORMAT_JSON || cb->format == WH_FORMAT_KAIROSDB)
                 cb->headers = curl_slist_append (cb->headers, "Content-Type: application/json");
         else
                 cb->headers = curl_slist_append (cb->headers, "Content-Type: text/plain");
@@ -245,7 +246,7 @@ static int wh_flush_nolock (cdtime_t timeout, wh_callback_t *cb) /* {{{ */
                 status = wh_send_buffer (cb);
                 wh_reset_buffer (cb);
         }
-        else if (cb->format == WH_FORMAT_JSON)
+        else if (cb->format == WH_FORMAT_JSON || cb->format == WH_FORMAT_KAIROSDB)
         {
                 if (cb->send_buffer_fill <= 2)
                 {
@@ -456,7 +457,7 @@ static int wh_write_json (const data_set_t *ds, const value_list_t *vl, /* {{{ *
                         &cb->send_buffer_fill,
                         &cb->send_buffer_free,
                         ds, vl, cb->store_rates);
-        if (status == (-ENOMEM))
+        if (status == -ENOMEM)
         {
                 status = wh_flush_nolock (/* timeout = */ 0, cb);
                 if (status != 0)
@@ -488,6 +489,60 @@ static int wh_write_json (const data_set_t *ds, const value_list_t *vl, /* {{{ *
         return (0);
 } /* }}} int wh_write_json */
 
+static int wh_write_kairosdb (const data_set_t *ds, const value_list_t *vl, /* {{{ */
+                wh_callback_t *cb)
+{
+        int status;
+
+        pthread_mutex_lock (&cb->send_lock);
+
+        if (cb->curl == NULL)
+        {
+                status = wh_callback_init (cb);
+                if (status != 0)
+                {
+                        ERROR ("write_http plugin: wh_callback_init failed.");
+                        pthread_mutex_unlock (&cb->send_lock);
+                        return (-1);
+                }
+        }
+
+        status = format_kairosdb_value_list (cb->send_buffer,
+                        &cb->send_buffer_fill,
+                        &cb->send_buffer_free,
+                        ds, vl, cb->store_rates);
+        if (status == -ENOMEM)
+        {
+                status = wh_flush_nolock (/* timeout = */ 0, cb);
+                if (status != 0)
+                {
+                        wh_reset_buffer (cb);
+                        pthread_mutex_unlock (&cb->send_lock);
+                        return (status);
+                }
+
+                status = format_kairosdb_value_list (cb->send_buffer,
+                                &cb->send_buffer_fill,
+                                &cb->send_buffer_free,
+                                ds, vl, cb->store_rates);
+        }
+        if (status != 0)
+        {
+                pthread_mutex_unlock (&cb->send_lock);
+                return (status);
+        }
+
+        DEBUG ("write_http plugin: <%s> buffer %zu/%zu (%g%%)",
+                        cb->location,
+                        cb->send_buffer_fill, cb->send_buffer_size,
+                        100.0 * ((double) cb->send_buffer_fill) / ((double) cb->send_buffer_size));
+
+        /* Check if we have enough space for this command. */
+        pthread_mutex_unlock (&cb->send_lock);
+
+        return (0);
+} /* }}} int wh_write_kairosdb */
+
 static int wh_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */
                 user_data_t *user_data)
 {
@@ -499,11 +554,17 @@ static int wh_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */
 
         cb = user_data->data;
 
-        if (cb->format == WH_FORMAT_JSON)
+        switch(cb->format) {
+            case WH_FORMAT_JSON:
                 status = wh_write_json (ds, vl, cb);
-        else
+                break;
+            case WH_FORMAT_KAIROSDB:
+                status = wh_write_kairosdb (ds, vl, cb);
+                break;
+            default:
                 status = wh_write_command (ds, vl, cb);
-
+                break;
+        }
         return (status);
 } /* }}} int wh_write */
 
@@ -525,6 +586,8 @@ static int config_set_format (wh_callback_t *cb, /* {{{ */
                 cb->format = WH_FORMAT_COMMAND;
         else if (strcasecmp ("JSON", string) == 0)
                 cb->format = WH_FORMAT_JSON;
+        else if (strcasecmp ("KAIROSDB", string) == 0)
+                cb->format = WH_FORMAT_KAIROSDB;
         else
         {
                 ERROR ("write_http plugin: Invalid format string: %s",
index e881593..6b5bc39 100644 (file)
 #include "plugin.h"
 #include "common.h"
 #include "configfile.h"
-#include "utils_cache.h"
 #include "utils_cmd_putval.h"
 #include "utils_format_graphite.h"
 #include "utils_format_json.h"
-#include "utils_crc32.h"
 
 #include <stdint.h>
 #include <librdkafka/rdkafka.h>
-#include <zlib.h>
 #include <errno.h>
 
 struct kafka_topic_context {
@@ -73,11 +70,19 @@ static void kafka_log(const rd_kafka_t *rkt, int level,
 }
 #endif
 
+static uint32_t kafka_hash(const char *keydata, size_t keylen)
+{
+    uint32_t hash = 5381;
+    for (; keylen > 0; keylen--)
+        hash = ((hash << 5) + hash) + keydata[keylen - 1];
+    return hash;
+}
+
 static int32_t kafka_partition(const rd_kafka_topic_t *rkt,
                                const void *keydata, size_t keylen,
                                int32_t partition_cnt, void *p, void *m)
 {
-    uint32_t key = *((uint32_t *)keydata );
+    uint32_t key = kafka_hash(keydata, keylen);
     uint32_t target = key % partition_cnt;
     int32_t  i = partition_cnt;
 
index ac4e9f5..ac6b8fb 100644 (file)
  *   Gergely Nagy <algernon at madhouse-project.org>
  */
 
-#include <riemann/riemann-client.h>
-#include <errno.h>
-
 #include "collectd.h"
+
+
 #include "plugin.h"
 #include "common.h"
 #include "configfile.h"
@@ -39,6 +38,9 @@
 #include "utils_complain.h"
 #include "write_riemann_threshold.h"
 
+#include <errno.h>
+#include <riemann/riemann-client.h>
+
 #define RIEMANN_HOST           "localhost"
 #define RIEMANN_PORT           5555
 #define RIEMANN_TTL_FACTOR      2.0
index 8567288..a4249ec 100644 (file)
  *   Andrés J. Díaz <ajdiaz at connectical.com>
  **/
 
-#include <assert.h>
-#include <ltdl.h>
-#include <pthread.h>
-
 #include "collectd.h"
 #include "common.h"
 #include "plugin.h"
index 0e9fee3..87c6517 100644 (file)
@@ -34,8 +34,6 @@
 #include "common.h"
 #include "plugin.h"
 
-#include <sys/types.h>
-#include <sys/vm_usage.h>
 #include <procfs.h>
 #include <zone.h>
 
@@ -49,20 +47,12 @@ typedef struct zone_stats {
        ushort_t      pctmem;
 } zone_stats_t;
 
-static long pagesize;
-
-static int zone_init (void)
-{
-       pagesize = sysconf(_SC_PAGESIZE);
-       return (0);
-}
-
 static int
-zone_compare(const zoneid_t *a, const zoneid_t *b)
+zone_compare(const void *a, const void *b)
 {
-       if (*a == *b)
+       if (*(const zoneid_t *)a == *(const zoneid_t *)b)
                return(0);
-       if (*a < *b)
+       if (*(const zoneid_t *)a < *(const zoneid_t *)b)
                return(-1);
        return(1);
 }
@@ -162,7 +152,7 @@ zone_scandir(DIR *procdir)
        c_avl_tree_t *tree;
        zone_stats_t *stats;
 
-       if (!(tree=c_avl_create((void *) zone_compare))) {
+       if (!(tree=c_avl_create(zone_compare))) {
                WARNING("zone plugin: Failed to create tree");
                return(NULL);
        }
@@ -210,6 +200,5 @@ static int zone_read (void)
 
 void module_register (void)
 {
-       plugin_register_init ("zone", zone_init);
        plugin_register_read ("zone", zone_read);
 } /* void module_register */
index 89ec6d2..860e93d 100644 (file)
@@ -111,7 +111,7 @@ static int zookeeper_connect (void)
        const char *host;
        const char *port;
 
-       memset ((void *) &ai_hints, '\0', sizeof (ai_hints));
+       memset (&ai_hints, '\0', sizeof (ai_hints));
        ai_hints.ai_family   = AF_UNSPEC;
        ai_hints.ai_socktype = SOCK_STREAM;
 
index d7c6a76..70b8c26 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-DEFAULT_VERSION="5.5.1.git"
+DEFAULT_VERSION="5.5.2.git"
 
 if [ -d .git ]; then
        VERSION="`git describe --dirty=+ --abbrev=7 2> /dev/null | grep collectd | sed -e 's/^collectd-//' -e 's/-/./g'`"