From: Ruben Kerkhof Date: Tue, 26 Jul 2016 10:50:07 +0000 (+0200) Subject: Merge branch 'collectd-5.4' into collectd-5.5 X-Git-Tag: collectd-5.6.0~3^2~9 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=dc2eb04;p=collectd.git Merge branch 'collectd-5.4' into collectd-5.5 Conflicts: ChangeLog contrib/redhat/collectd.spec version-gen.sh --- dc2eb041159b967838a2eb658cb256bc846c5264 diff --cc ChangeLog index 0a823b07,cc820fc5..25257d76 --- a/ChangeLog +++ b/ChangeLog @@@ -28,378 -100,81 +28,436 @@@ * 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 - * PF plugin and DNS plugin: These plugins have been fixed to build - properly on OpenBSD again. Thanks to Ruben Kerkhof. -- * Processes plugin: A compilation error on systems without "regex.h" has -- been fixed. Thanks to Corey Kosak. -- * Processes plugin: A memory leak on Solaris has been fixed. Thanks to -- Jim Quinn. + * 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 + Berkley. #1063 + * Build system: Dependency ordering was fixed to ensure parallel builds + work reliably. Thanks to Gustavo Zacarias. #1125 + * Build system: Error messages have been improved and building the unit + tests has been fixed on Solaris. Thanks to Florian Forster and + Dagobert Michelsen. #1077 + * Build system: The move of the "utils_ignorelist" functions has been + reverted. This fixes build issues of numerous plugins. Thanks to + Benjamin Drung;. #1323 + * Build system: The fhcount plugin has been restricted to Linux. Thanks + to Ruben Kerkhof. #1195 + * Build system: Detection of header files for the turbostat plugin has + been fixed. Thanks to Marc Fournier. #1075 + * collectd: The "LC_NUMERIC" locale is now forced, to prevent issues + with some plugins on environments using a comma as decimal separator. + Thanks to Florian Forster. #1237 + * Documentation: Some precisions related to the virt plugin have beed + added. Thanks to Wojtek Bocer and Ruben Kerkhof. + * Documentation: The CollectdInternalStats documentation has been + improved. Thanks to Yves Mettier and Florian Forster. + * Battery plugin: A missing Type has been added. Thanks to Marc + Fournier. #1338 + * Bind plugin: An off-by-one error has been fixed: an index was checked + against a wrong variable, which may lead to an out-of-bounds read. + Thanks to Michal Humpula. #1123 + * Ceph plugin: JSON parsing has been refactored to support ceph 10.0.0 + and fixes several buffer overflows. Thanks to Florian Forster. #1350 + * CPU plugin: A Mac OS X specific bug has been fixed: the plugin + expected an incorrect number of CPU states, resulting in failing read + callbacks. This regression was introduced in 5.5.0. Thanks to Robert + Viduya. + * Disk plugin: Support for Mac OS X 10.10 has been added. Thanks to + Robert Viduya. #1065 + * IPC plugin: Support for building with musl-libc has been added. Thanks + to Natanael Copa. #1147 + * Log Logstash plugin: A segfault when using libyajl, version 1 was + fixed. Thanks to Vincent Bernat. #1190 + * Log Logstash plugin: The timestamp is now ISO 8601 compliant. Thanks + to Marc Fournier. #1132 + * memcached plugin: The Type of the listen-disabled metric was fixed. + Thanks to Florian Forster. #1356 + * MySQL plugin: The Type used by Innodb_buffer_pool_pages_flushed was + fixed. Thanks to Marek Becka. #1085 + * OpenLDAP plugin: A crash when using LDAPI (LDAP-over-IPC) got fixed. + Thanks to Marek Becka. #1080 + * OpenLDAP plugin: Support for Mac OS X has been added. Thanks to Ruben + Kerkhof. #1489 + * SMART plugin: A memory leak has been fixed. Thanks to Florian + Schüller and Pierre-Yves Ritschard. #1076 + * Swap plugin: A regression that would lead to swap usage being reported + in kilobytes (instead of bytes) has been fixed. Thanks to Marek Becka. + #1071 + * Varnish plugin: Support for FreeBSD has been added. Thanks to Ruben + Kerkhof. #1182 + * Varnish plugin: Support for versions 3 and 4 has been made more + tolerant to minor changes in Varnish point releases. Thanks to Marc + Fournier. #1302 + * virt plugin: A copy-and-paste mistake in an error message has been + fixed. Thanks to Ruben Kerkhof. #1101 + * Write Kafka plugin: Support for Solaris has been added. Thanks to + Shahul Hameed. #1171 + * Write Redis plugin: Dead code has been removed. Thanks to Brian Kelly. + #1143 + * 27 patches have been applied to numerous plugins and core components, + fixing various programming errors which were reported by scan-build, + libasan, FBInfer, coverity-scan and clang: Thanks to Ruben Kerkhof, + Florian Forster and Marek Becka. + * Collectd::Unixsock: A Perl error got corrected. Thanks to Ciaran Mac + An Iomaire. #1295 + +2015-05-27, Version 5.5.0 + * Build system: Ability to make out-of-tree builds has been fixed. + Thanks to Vincent Bernat. #792 + * Build system, Disk and Users plugins: Detection and use of libstatgrab + ≧ 0.90 has been added. Thanks to Vincent Bernat. #445, #795, #806, + #807, #908 + * Build system, Memory, CPU, TCPConns and Processes plugins: Numerous + fixes related to OpenBSD support have been added. Thanks to Landry + Breuil. #777, #778, #779, #808 + * Build system: Plugins now only export "module_register()". Thanks to + Florian Forster. + * Build system: Various cleanups and improvements have been done. Thanks + to Marc Fournier. + * collectd: Numerous internal changes and improvements to the daemon and + the plugin API have been make. Thanks to Florian Forster, Pierre-Yves + Ritschard and Alex Petrov. #512, #727 + * collectd: Numerous spelling mistakes have been corrected in comments + and documentation and several error messages have been improved. + Thanks to Ruben Kerkhof, Abhinav Upadhyay, Olivier Bazoud, Pierre-Yves + Ritschard, Tim Smith, Moshe Zada, Katelyn Perry and Marc Fournier. + * collectd: Rules/Targets can now be appended to existing Filter Chains. + Thanks to Marc Falzon. #444 + * collectd: Failing Filter Chains destinations will now log the list of + available write targets. Thanks to Wilfried Goesgens. #650, #1043 + * collectd: Support for process signaling and management by upstart and + systemd has been implemented for the Linux platform. Thanks to + Pierre-Yves Ritschard and Marc Fournier. #798, #811, #814 + * collectd: The "CollectInternalStats" option has been added. Thanks to + Yves Mettier. #691 + * collectd: The daemon source code and dependencies have moved to the + "src/daemon/" directory. Thanks to Florian Forster. + * collectd: The new "MaxReadInterval" option allows to cap the + exponential retry interval of plugins read errors. Thanks to Alexey + Remizov and Florian Forster. #713 + * collectd: The "-P" command-line option now has precedence over the + "PIDFile" option. Thanks to Thomas D. #553 + * collection.cgi: Various data-source related adjustments have been + made. Thanks to Fabiano Pires and Sebastian Harl. + * libcollectdclient: Now propagates errors when signing / encrypting + network packets. Thanks to Florian Forster. + * Configuration: Support for unquoted IPv6 addresses has been added. + Thanks to Sebastian Harl. #489 + * Documentation: Various improvements have been done. Thanks to Florian + Forster and Marc Fournier. + * Examples: the sample C plugin has been updated to the current plugin + API. Thanks to Sebastian Harl. + * Licensing: The following components have been relicensed to the MIT + license: the Apple Sensors, Ascent, DBI, E-Mail, Entropy, GenericJMX, + gmond, LogFile, nginx, Notify Desktop, NTPd, NUT, olsrd, Perl, Ping, + PostgreSQL, Protocols, RouterOS, RRDCacheD, SNMP, StatsD, SysLog, + Table, Tail, UnixSock, vmem, VServer, Wireless, Write Riemann and XMMS + plugins, the core collectd daemon, the collectdmon, collectd-nagios + and collectd-tg utilities, all the Targets and Matches, liboconfig, + most of the "utils_*" files and the plugin API. + * Tests: A test suite has been added. Thanks to Florian Forster. + * Threshold: The hysteresis calculation has been made more reliable. + Thanks to Jan Kundrát. #581 + * Threshold: Various fixes and improvements have been made. Thanks to + Manuel Luis Sanmartín Rozada. #649, #644 + * AMQP plugin: The "ConnectionRetryDelay" option has been added, + allowing to delay reconnection. Thanks to Yoga Ramalingam and Marc + Fournier. #833 + * AMQP plugin: The "QueueDurable" and "QueueAutoDelete" options have + been added, giving control over queue creation and deletion. Thanks to + David Blundell and Marc Fournier. #623 + * Apache, Ascent, BIND, cURL, cURL-JSON, cURL-XML, nginx and Write HTTP + plugins: Customizing the "User-Agent" field is now possible at + compile-time. Thanks to Jeremy Katz. #440 + * Apache, Ascent, BIND, cURL, cURL-JSON, cURL-XML, nginx plugins: The + connection will be reset if it hasn't completed within the configured + "Interval". The new "Timeout" option gives control over this behavior. + Thanks to Jan Kundrát and Marc Fournier. #982, #983, #993 + * Apache, Ascent, cURL, cURL-JSON, cURL-XML, nginx, Write HTTP plugins: + Allow usernames and passwords to contain colons if built against + libcurl ≧ 7.19.1. Thanks to Marc Fournier. #695, #947 + * Apache plugin: The "SSLCiphers" option gives control over the + encryption algorithms to use with TLS connections. Thanks to Toni + Moreno. #946 + * Barometer plugin: This new plugin reads sensor data from various + Freescale and Bosch digital barometers. Thanks to Tomas Menzl. #69, + #693 + * Battery plugin: Reporting values as percentages and reporting degraded + batteries has been added. Thanks to Florian Forster. + * Battery plugin: Support for reading values from sysfs on Linux has + been added. Thanks to Andy Parkins, Nicholas Humfrey, Peter Wu and + Florian Forster. #725, #810, #998 + * Battery plugin: The value for current is no longer supplied unless the + battery provides this information. Thanks to Florian Forster. + * BIND plugin: Bind's XML v3 API is now supported; Thanks to Victor + Berger, Bruno Prémont and Michal Humpula. #742, #847 + * Ceph plugin: This new plugin collects statistics from the Ceph + distributed storage system. Thanks to Dan Ryder, Dennis Zou, Colin + McCabe, Sage Weil. #522, #598 + * ConnTrack plugin: Support for reporting values as percentages as well + as legacy conntrack files in "/proc" has been added. Thanks to + Pierre-Yves Ritschard. #497, #680 + * CPU plugin: The plugin is now able to report values as percentages and + aggregate values per-state and per-CPU. Thanks to Pierre-Yves + Ritschard, Florian Forster, Fabien Wernli, Nicholas Humfrey and + Wilfried Goesgens. #499, #516, #639 #734, #812, #802 + * cURL-JSON plugin: Extracting values from complex JSON structures has + been enhanced. Thanks to Jim Radford. #408, #411 + * cURL-JSON plugin: Intervals can now be configured on a per-URL basis. + Thanks to Stan Sawa. #685 + * cURL-JSON, cURL-XML, Write HTTP plugins: These plugins now also follow + HTTP redirects. Thanks to Marc Fournier. + * cURL, cURL-JSON, cURL-XML plugins: HTTP Digest authentication has been + implemented. Thanks to Frank Cornelis. #482 + * DBI, Oracle, PostgreSQL plugins: A "MetadataFrom" parameter has been + added which allows to set metadata from database columns. Thanks to + Mark Wong. #317, #321 + * DBI plugin: Querying several databases in parallel is now possible. + Thanks to Vincent Bernat. #453 + * Disk plugin: On the Linux platform, disk names can now get looked up + in udev with the "UdevNameAttr" option. Thanks to Patrick Mooney. #537 + * Disk plugin: This plugin now collects several additional I/O-related + metrics on the Linux platform. Thanks to Florian Forster and Michael + Schenck. #705, #759 + * DRBD plugin: This new plugin reads Linux's Distributed Replicated + Block Device (DRBD) statistics. Thanks to Tim Laszlo. #566, #700 + * Exec, UnixSock plugins: The "PUTNOTIF" command now allows to set + metadata on notifications. Thanks to John-John Tedro. #416 + * fhcount plugin: This new plugin reports the number of used file + handles. Thanks to Jiri Tyr. #1009 + * GenericJMX plugin: A Class Loader for "JMXConnectorFactory" has been + added, allowing the plugin to work with JBOSS > 7. Thanks to Alexandre + Moutot. #452 + * IPC plugin: This new plugin collects information related to shared + memory. Thanks to Andrés J. Díaz. #925 + * Java plugin: Now uses the hostname defined in the configuration file. + Thanks to Pierre-Yves Ritschard. #530, #681 + * Load plugin: The plugin is now able to report values as percentages. + Thanks to Vedran Bartonicek and Pierre-Yves Ritschard. #344, #498 + * Log Logstash plugin: This new plugin writes collectd logs and events + as Logstash JSON formatted events. Thanks to Pierre-Yves Ritschard. + #360 + * LVM plugin: The plugin collects thin pool data volumes size, and no + longer reports virtual volumes. Thanks to Benjamin Gilbert. #603 + * memcached plugin: "listen_disabled_num" are now also reported. Thanks + to Matt Cottingham. #622 + * Memory plugin: Slab memory reporting on the Linux platform has been + added. Thanks to Manuel CISSÉ and Marc Fournier. #560, #697 + * Memory plugin: The plugin is now able to report values as percentages. + Thanks to Jeremy Katz, Florian Forster and Manuel CISSÉ. #501, #511, + #559 + * Modbus plugin: Selecting between holding and input registers is now + possible. Thanks to Jan Vitek. #338 + * Modbus plugin: Support for accessing devices through an RS-485 serial + port has been added. Thanks to Eric Sandeen. + * Multimeter plugin: This plugin isn't built by default on the AIX + platform anymore. Thanks to Manuel Luis Sanmartin Rozada. #549, #684 + * MySQL and PostgreSQL plugins: Passing "127.0.0.1" as a host will now + result in the global Hostname being used in metric names. Thanks to + Jeremy Katz. #441 + * MySQL plugin: InnoDB, Select and Sort statistics collection has been + added. Thanks to Wilson Felipe, Marek Becka and Pierre-Yves Ritschard. + #248, #621, #699, #824 + * MySQL plugin: The "Alias" and "ConnectTimeout" options have been + added. Thanks to William Tisäter. + * Netlink plugin: Support for 64bit netlink counters has been added. + Thanks to Marek Becka. #435 + * Network plugin: The "ReconnectInterval" configuration option has been + added. Thanks to John Ferlito. #732 + * NFS plugin: Support for NFSv4.0 has been implemented. Thanks to Marek + Becka. #550 + * OneWire plugin: Support for more temperature-providing sensor families + has been added. Thanks to Tomasz Torcz. #672 + * OneWire plugin: Support for full OWFS path and more device families + has been implemented. Thanks to Tomas Menzl. #68 + * OpenLDAP plugin: This new plugin reads monitoring information from + OpenLDAP's "cn=Monitor" subtree. Thanks to Kimo Rosenbaum, Marc + Fournier and Nicholas Humfrey. #719 + * OpenVPN plugin: Support for OpenVPN 2.3.0 has been implemented. Thanks + to Ed Okerson. #252 + * OpenVZ plugin: Various improvements have been made, making the plugin + report values like the other collectd plugins do. Thanks to Chris + Lundquist. #264 + * Perl plugin: A new "listval_filter" method has been added, various + internal cleanups and improvements have been made and a test suite has + been added. Thanks to Matthias Bethke. #728 + * PostgreSQL plugin: The new "ExpireDelay" option allows skipping older + values pending write when the database slows down. Thanks to Stephen + O'Dor. #593 + * PowerDNS plugin: The plugin was updated for stats from pdns 3.4.3. + Thanks to Ruben Kerkhof. #965 + * Processes plugin: A memory-usage related optimization for low-profile + systems has been added. Thanks to Florian Forster. #652 + * Python plugin: Support for Python3 has been improved, "ModulePath" is + now prepended to "sys.path", and the "get_dataset()" function has been + added to the Python API. Thanks to Sven Trenkel and Patrick Browne. + #890, #751, #771 + * Redis and Write_Redis plugins: The support library has been switched + from credis to hiredis. Thanks to Andrés J. Díaz, Victor Seva, Marc + Fournier, Johan Bergström, Michael Spiegle and brianpkelly. #296, + #464, #475, #799, #1030 + * Redis plugin: Custom commands can now be used to fetch values stored + in Redis. Thanks to Pierre-Yves Ritschard. #816 + * Redis plugin: Support for passwords up to 512 characters long has been + added. Thanks to Jeremy Katz. #532 + * Sensors plugin: Support for lm_sensors' power sensors has been added. + Thanks to Jan Kundrát. #571 + * SMART plugin: This new plugin collects SMART statistics from disk + drives. Thanks to Vincent Bernat. #797 + * SNMP plugin: A blacklist/whitelist feature can now be used to filter + which OIDs to collect. Thanks to Christophe Courtaut. #414 + * SNMP plugin: SNMPv3 authentication and encryption support has been + implemented. Thanks to Michael Pilat. #362 + * SNMP plugin: Two error messages have been disambiguated. Thanks to + Sergey. #939, #952 + * Swap plugin: The plugin is now able to report values as percentages. + Thanks to Jeremy Katz and Florian Forster. #500, #510 + * Swap plugin: The plugin no longer fails on Linux systems where + "SwapCached" isn't exposed by the kernel. Thanks to Florian Forster. + #733 + * Tail plugin: "GaugeInc" and "GaugeAdd" options have been implemented. + Thanks to Andre Ferraz. #673 + * Tail plugin: Intervals can now be configured on a per-File basis. + Thanks to Tom Leaman. #446 + * TCPConns plugin: The "AllPortsSummary" option, allowing to summarize + all connections, has been added. Thanks to Marek Becka. #488 + * TCPConns plugin: Three metrics were renamed on the AIX platform, for + the sake of consistency. Thanks to Manuel Luis Sanmartín Rozada. #546 + * Turbostat plugin: This new plugin reads CPU frequency and C-state + residency on modern Intel turbo-capable processors. Thanks to Vincent + Brillault, Jean Delvare and Nicolas Iooss. #651 + * UnixSock plugin: The "GETTHRESHOLD" command has been re-added. Thanks + to Manuel Luis Sanmartín Rozada. #674 + * Varnish plugin: Varnish 4 support has been added, as well as as + monitoring metrics only available in Varnish 4. Thanks to Marc + Fournier. #618, #783 + * virt plugin: Guests memory usage is now also collected. Thanks to + Tiago Carvalho, jazzmes and Zollner Robert. + * virt plugin: It is now possible to chose between using guests' name or + UUID as plugin_instance. Thanks to Remi Ferrand. #385 + * virt plugin: The libvirt plugin has been renamed to virt. Thanks to + Florian Forster. + * Write Graphite plugin: When the connection to graphite fails, + reconnection attempts are now limited to once per second. Thanks to + Florian Forster. #625 + * Write HTTP plugin: Multi-instance support of this plugin has been + improved. The "" block has been deprecated in favor of + "". Thanks to Marc Fournier. #902 + * Write HTTP plugin: Several TLS-related configuration options have been + added. Thanks to Ingmar Runge. #666 + * Write HTTP plugin: The "LowSpeedLimit" and "Timeout" options allow to + reset slow/stalled network connections. Thanks to loginator17 and Marc + Fournier. #752, #985 + * Write HTTP plugin: The size of the payload posted to the HTTP server + can now be controlled with the "BufferSize" option. Thanks to Florian + Forster. #722 + * Write Kafka plugin: This new plugin sends data to Apache Kafka, a + distributed messaging queue. Thanks to Pierre-Yves Ritschard, + ciomaire, Vincent Bernat, Marc Fournier. #670, #694, #794, #853, #014 + * Write Log plugin: This new plugin dispatches collected values to the + configured log destination(s). Thanks to Pierre-Yves Ritschard. #886 + * Write Riemann plugin: Extra meta strings are now added as attributes + in notifications. Thanks to John-John Tedro. #417 + * Write Riemann plugin: Notification message are now sent to the Riemann + server via the description field. Thanks to Adrian Miron. #575 + * Write Riemann plugin: Support for custom attributes has been added. + Thanks to Pierre-Yves Ritschard. #459 + * Write Riemann plugin: Support had been implemented for sending events + to Riemann in batches (when using TCP), and is enabled by default. + Thanks to Pierre-Yves Ritschard. #800 + * Write Riemann plugin: The "EventServicePrefix" option has been added, + which adds a prefix to event service names. Thanks to Moshe Zada. #706 + * Write Riemann plugin: Threshold checks can now be passed down to the + Riemann server. Thanks to Pierre-Yves Ritschard. #518 + * Write Sensu plugin: This new plugin submits values to Sensu, a stream + processing and monitoring system. Thanks to Fabrice A. Marie and Marc + Fournier. #912, #1001, #1016 + * Write TSDB plugin: This new plugin sends data to OpenTSDB, a scalable + time series database. Thanks to Kevin Bowling, Florian Forster, Dallin + Young, Michael Schenck and Pierre-Yves Ritschard. #703, #772, #945 + * ZFS ARC plugin: Support for ZFS-on-Linux has been added. Thanks to + 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, diff --cc src/daemon/meta_data.c index e1d0ec5b,00000000..29236e2f mode 100644,000000..100644 --- a/src/daemon/meta_data.c +++ b/src/daemon/meta_data.c @@@ -1,638 -1,0 +1,649 @@@ +/** + * collectd - src/meta_data.c + * Copyright (C) 2008-2011 Florian octo Forster + * + * 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: + * Florian octo Forster + **/ + +#include "collectd.h" +#include "plugin.h" +#include "meta_data.h" + +#include + +/* + * Data types + */ +union meta_value_u +{ + char *mv_string; + int64_t mv_signed_int; + uint64_t mv_unsigned_int; + double mv_double; + _Bool mv_boolean; +}; +typedef union meta_value_u meta_value_t; + +struct meta_entry_s; +typedef struct meta_entry_s meta_entry_t; +struct meta_entry_s +{ + char *key; + meta_value_t value; + int type; + meta_entry_t *next; +}; + +struct meta_data_s +{ + meta_entry_t *head; + pthread_mutex_t lock; +}; + +/* + * Private functions + */ +static char *md_strdup (const char *orig) /* {{{ */ +{ + size_t sz; + char *dest; + + if (orig == NULL) + return (NULL); + + sz = strlen (orig) + 1; + dest = (char *) malloc (sz); + if (dest == NULL) + return (NULL); + + memcpy (dest, orig, sz); + + return (dest); +} /* }}} char *md_strdup */ + +static meta_entry_t *md_entry_alloc (const char *key) /* {{{ */ +{ + meta_entry_t *e; + + e = (meta_entry_t *) malloc (sizeof (*e)); + if (e == NULL) + { + ERROR ("md_entry_alloc: malloc failed."); + return (NULL); + } + memset (e, 0, sizeof (*e)); + + e->key = md_strdup (key); + if (e->key == NULL) + { + free (e); + ERROR ("md_entry_alloc: md_strdup failed."); + return (NULL); + } + + e->type = 0; + e->next = NULL; + + return (e); +} /* }}} meta_entry_t *md_entry_alloc */ + +static meta_entry_t *md_entry_clone (const meta_entry_t *orig) /* {{{ */ +{ + meta_entry_t *copy; + + if (orig == NULL) + return (NULL); + + copy = md_entry_alloc (orig->key); + if (copy == NULL) + return (NULL); + copy->type = orig->type; + if (copy->type == MD_TYPE_STRING) + copy->value.mv_string = strdup (orig->value.mv_string); + else + copy->value = orig->value; + + copy->next = md_entry_clone (orig->next); + return (copy); +} /* }}} meta_entry_t *md_entry_clone */ + +static void md_entry_free (meta_entry_t *e) /* {{{ */ +{ + if (e == NULL) + return; + + free (e->key); + + if (e->type == MD_TYPE_STRING) + free (e->value.mv_string); + + if (e->next != NULL) + md_entry_free (e->next); + + free (e); +} /* }}} void md_entry_free */ + +static int md_entry_insert (meta_data_t *md, meta_entry_t *e) /* {{{ */ +{ + meta_entry_t *this; + meta_entry_t *prev; + + if ((md == NULL) || (e == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + prev = NULL; + this = md->head; + while (this != NULL) + { + if (strcasecmp (e->key, this->key) == 0) + break; + + prev = this; + this = this->next; + } + + if (this == NULL) + { + /* This key does not exist yet. */ + if (md->head == NULL) + md->head = e; + else + { + assert (prev != NULL); + prev->next = e; + } + + e->next = NULL; + } + else /* (this != NULL) */ + { + if (prev == NULL) + md->head = e; + else + prev->next = e; + + e->next = this->next; + } + + pthread_mutex_unlock (&md->lock); + + if (this != NULL) + { + this->next = NULL; + md_entry_free (this); + } + + return (0); +} /* }}} int md_entry_insert */ + +/* XXX: The lock on md must be held while calling this function! */ +static meta_entry_t *md_entry_lookup (meta_data_t *md, /* {{{ */ + const char *key) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL)) + return (NULL); + + for (e = md->head; e != NULL; e = e->next) + if (strcasecmp (key, e->key) == 0) + break; + + return (e); +} /* }}} 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) /* {{{ */ +{ + meta_data_t *md; + + md = (meta_data_t *) malloc (sizeof (*md)); + if (md == NULL) + { + ERROR ("meta_data_create: malloc failed."); + return (NULL); + } + memset (md, 0, sizeof (*md)); + + md->head = NULL; + pthread_mutex_init (&md->lock, /* attr = */ NULL); + + return (md); +} /* }}} meta_data_t *meta_data_create */ + +meta_data_t *meta_data_clone (meta_data_t *orig) /* {{{ */ +{ + meta_data_t *copy; + + if (orig == NULL) + return (NULL); + + copy = meta_data_create (); + if (copy == NULL) + return (NULL); + + pthread_mutex_lock (&orig->lock); + copy->head = md_entry_clone (orig->head); + pthread_mutex_unlock (&orig->lock); + + return (copy); +} /* }}} meta_data_t *meta_data_clone */ + +void meta_data_destroy (meta_data_t *md) /* {{{ */ +{ + if (md == NULL) + return; + + md_entry_free (md->head); + pthread_mutex_destroy (&md->lock); + free (md); +} /* }}} void meta_data_destroy */ + +int meta_data_exists (meta_data_t *md, const char *key) /* {{{ */ +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + for (e = md->head; e != NULL; e = e->next) + { + if (strcasecmp (key, e->key) == 0) + { + pthread_mutex_unlock (&md->lock); + return (1); + } + } + + pthread_mutex_unlock (&md->lock); + return (0); +} /* }}} int meta_data_exists */ + +int meta_data_type (meta_data_t *md, const char *key) /* {{{ */ +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL)) + return -EINVAL; + + pthread_mutex_lock (&md->lock); + + for (e = md->head; e != NULL; e = e->next) + { + if (strcasecmp (key, e->key) == 0) + { + pthread_mutex_unlock (&md->lock); + return e->type; + } + } + + pthread_mutex_unlock (&md->lock); + return 0; +} /* }}} int meta_data_type */ + +int meta_data_toc (meta_data_t *md, char ***toc) /* {{{ */ +{ + int i = 0, count = 0; + meta_entry_t *e; + + if ((md == NULL) || (toc == NULL)) + return -EINVAL; + + pthread_mutex_lock (&md->lock); + + for (e = md->head; e != NULL; e = e->next) + ++count; + + if (count == 0) + { + pthread_mutex_unlock (&md->lock); + return (count); + } + + *toc = calloc(count, sizeof(**toc)); + for (e = md->head; e != NULL; e = e->next) + (*toc)[i++] = strdup(e->key); + + pthread_mutex_unlock (&md->lock); + return count; +} /* }}} int meta_data_toc */ + +int meta_data_delete (meta_data_t *md, const char *key) /* {{{ */ +{ + meta_entry_t *this; + meta_entry_t *prev; + + if ((md == NULL) || (key == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + prev = NULL; + this = md->head; + while (this != NULL) + { + if (strcasecmp (key, this->key) == 0) + break; + + prev = this; + this = this->next; + } + + if (this == NULL) + { + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + if (prev == NULL) + md->head = this->next; + else + prev->next = this->next; + + pthread_mutex_unlock (&md->lock); + + this->next = NULL; + md_entry_free (this); + + return (0); +} /* }}} int meta_data_delete */ + +/* + * Add functions + */ +int meta_data_add_string (meta_data_t *md, /* {{{ */ + const char *key, const char *value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL) || (value == NULL)) + return (-EINVAL); + + e = md_entry_alloc (key); + if (e == NULL) + return (-ENOMEM); + + e->value.mv_string = md_strdup (value); + if (e->value.mv_string == NULL) + { + ERROR ("meta_data_add_string: md_strdup failed."); + md_entry_free (e); + return (-ENOMEM); + } + e->type = MD_TYPE_STRING; + + return (md_entry_insert (md, e)); +} /* }}} int meta_data_add_string */ + +int meta_data_add_signed_int (meta_data_t *md, /* {{{ */ + const char *key, int64_t value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL)) + return (-EINVAL); + + e = md_entry_alloc (key); + if (e == NULL) + return (-ENOMEM); + + e->value.mv_signed_int = value; + e->type = MD_TYPE_SIGNED_INT; + + return (md_entry_insert (md, e)); +} /* }}} int meta_data_add_signed_int */ + +int meta_data_add_unsigned_int (meta_data_t *md, /* {{{ */ + const char *key, uint64_t value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL)) + return (-EINVAL); + + e = md_entry_alloc (key); + if (e == NULL) + return (-ENOMEM); + + e->value.mv_unsigned_int = value; + e->type = MD_TYPE_UNSIGNED_INT; + + return (md_entry_insert (md, e)); +} /* }}} int meta_data_add_unsigned_int */ + +int meta_data_add_double (meta_data_t *md, /* {{{ */ + const char *key, double value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL)) + return (-EINVAL); + + e = md_entry_alloc (key); + if (e == NULL) + return (-ENOMEM); + + e->value.mv_double = value; + e->type = MD_TYPE_DOUBLE; + + return (md_entry_insert (md, e)); +} /* }}} int meta_data_add_double */ + +int meta_data_add_boolean (meta_data_t *md, /* {{{ */ + const char *key, _Bool value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL)) + return (-EINVAL); + + e = md_entry_alloc (key); + if (e == NULL) + return (-ENOMEM); + + e->value.mv_boolean = value; + e->type = MD_TYPE_BOOLEAN; + + return (md_entry_insert (md, e)); +} /* }}} int meta_data_add_boolean */ + +/* + * Get functions + */ +int meta_data_get_string (meta_data_t *md, /* {{{ */ + const char *key, char **value) +{ + meta_entry_t *e; + char *temp; + + if ((md == NULL) || (key == NULL) || (value == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + e = md_entry_lookup (md, key); + if (e == NULL) + { + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + if (e->type != MD_TYPE_STRING) + { + ERROR ("meta_data_get_string: Type mismatch for key `%s'", e->key); + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + temp = md_strdup (e->value.mv_string); + if (temp == NULL) + { + pthread_mutex_unlock (&md->lock); + ERROR ("meta_data_get_string: md_strdup failed."); + return (-ENOMEM); + } + + pthread_mutex_unlock (&md->lock); + + *value = temp; + + return (0); +} /* }}} int meta_data_get_string */ + +int meta_data_get_signed_int (meta_data_t *md, /* {{{ */ + const char *key, int64_t *value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL) || (value == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + e = md_entry_lookup (md, key); + if (e == NULL) + { + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + if (e->type != MD_TYPE_SIGNED_INT) + { + ERROR ("meta_data_get_signed_int: Type mismatch for key `%s'", e->key); + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + *value = e->value.mv_signed_int; + + pthread_mutex_unlock (&md->lock); + return (0); +} /* }}} int meta_data_get_signed_int */ + +int meta_data_get_unsigned_int (meta_data_t *md, /* {{{ */ + const char *key, uint64_t *value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL) || (value == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + e = md_entry_lookup (md, key); + if (e == NULL) + { + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + if (e->type != MD_TYPE_UNSIGNED_INT) + { + ERROR ("meta_data_get_unsigned_int: Type mismatch for key `%s'", e->key); + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + *value = e->value.mv_unsigned_int; + + pthread_mutex_unlock (&md->lock); + return (0); +} /* }}} int meta_data_get_unsigned_int */ + +int meta_data_get_double (meta_data_t *md, /* {{{ */ + const char *key, double *value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL) || (value == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + e = md_entry_lookup (md, key); + if (e == NULL) + { + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + if (e->type != MD_TYPE_DOUBLE) + { + ERROR ("meta_data_get_double: Type mismatch for key `%s'", e->key); + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + *value = e->value.mv_double; + + pthread_mutex_unlock (&md->lock); + return (0); +} /* }}} int meta_data_get_double */ + +int meta_data_get_boolean (meta_data_t *md, /* {{{ */ + const char *key, _Bool *value) +{ + meta_entry_t *e; + + if ((md == NULL) || (key == NULL) || (value == NULL)) + return (-EINVAL); + + pthread_mutex_lock (&md->lock); + + e = md_entry_lookup (md, key); + if (e == NULL) + { + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + if (e->type != MD_TYPE_BOOLEAN) + { + ERROR ("meta_data_get_boolean: Type mismatch for key `%s'", e->key); + pthread_mutex_unlock (&md->lock); + return (-ENOENT); + } + + *value = e->value.mv_boolean; + + pthread_mutex_unlock (&md->lock); + return (0); +} /* }}} int meta_data_get_boolean */ + +/* vim: set sw=2 sts=2 et fdm=marker : */