From: Florian Forster Date: Wed, 5 Mar 2008 08:16:16 +0000 (+0100) Subject: Merge branch 'collectd-4.2' into collectd-4.3 X-Git-Tag: collectd-4.3.1~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9ebb82bf36ac779a8af81f2e9a513226387a5679;p=collectd.git Merge branch 'collectd-4.2' into collectd-4.3 Conflicts: ChangeLog src/network.c version-gen.sh --- 9ebb82bf36ac779a8af81f2e9a513226387a5679 diff --cc ChangeLog index fc721914,7e472d14..a82e552b --- a/ChangeLog +++ b/ChangeLog @@@ -1,44 -1,20 +1,61 @@@ +2008-02-18, Version 4.3.0 + * collectd: Notifications have been added to the daemon. Notifications + are status messages that may be associated with a data instance. + * collectd: Threshold checking has been added to the daemon. This + means that you can configure threshold values for each data + instance. If this threshold is exceeded a notification will be + created. + * collectd: The new `FQDNLookup' option tells the daemon to use the + full qualified domain name as the hostname, not just the host part + es returned by `gethostname(2)'. + * collectd: Support for more than one `TypesDB' file has been added. + This is useful when one such file is included in a package but one + wants to add custom type definitions. + * collectd: The `Include' config option has been expanded to handle + entire directories and shell wildcards. + * collectdmon: The new `collectdmon' binary detects when collectd + terminates and automatically restarts it again. + * csv plugin: The CSV plugin is now able to store counter values as a + rate, using the `StoreRates' configuration option. + * exec plugin: Handling of notifications has been added and the + ability to pass arguments to the executed programs has been added. + * hddtemp plugin: The new `TranslateDevicename' option lets you + disable the translation from device names to major-minor-numbers. + * logfile plugin: Handling of notifications has been added. + * ntpd plugin: The new `ReverseLookups' can be used to disable reverse + domain name lookups in this plugin. + * perl plugin: Many internal changes added support for handling multiple + threads making the plugin reasonably usable inside collectd. The API has + been extended to support notifications and export global variables to + Perl plugins; callbacks now have to be identified by name rather than a + pointer to a subroutine. The plugin is no longer experimental. + * uuid plugin: The new UUID plugin sets the hostname to an unique + identifier for this host. This is meant for setups where each client + may migrate to another physical host, possibly going through one or + more name changes in the process. Thanks to Richard Jones from + Red Hat's Emerging Technology group for this plugin. + * libvirt: The new libvirt plugin uses the `libvirt' library to query + CPU, disk and network statistics about guest systems on the same + physical server. Thanks to Richard Jones from Red Hat's Emerging + Technology group for this plugin. + + 2008-03-04, Version 4.2.5 + * apache plugin: Improved initialization and error messages. + * exec plugin: Set supplementary group IDs. + * network plugin: + + Create separate threads for reading from the socket and parsing + and dispatching incoming packets. Versions prior to this may have + problems in high-load situations, where the socket receive buffers + overflows, resulting in gaps in the data. + + Use `memcpy' when constructing/parsing a package to avoid + alignment problems on weird architectures, such as Sparc. + + Translate doubles to/from the x86 byte representation to ensure + cross-platform compatibility. + * ping plugin: Correct the handling of the `TTL' setting. + * rrdtool plugin: Ensure correct handling of the `RRATimespan' option. + * swap plugin: Reapply a patch for Solaris. + * tcpconns plugin: Portability improvements. + 2008-01-21, Version 4.2.4 * unixsock plugin: A bug in the unixsock plugin caused it not to set the permission on the socket as documented in the manpage. Thanks to diff --cc src/network.c index 98f49dd6,34a16690..a0e1383b --- a/src/network.c +++ b/src/network.c @@@ -600,21 -685,30 +686,32 @@@ static int parse_packet (void *buffer, memset (&vl, '\0', sizeof (vl)); memset (&type, '\0', sizeof (type)); + memset (&n, '\0', sizeof (n)); status = 0; - while ((status == 0) && (buffer_len > sizeof (part_header_t))) + while ((status == 0) && (0 < buffer_len) + && ((unsigned int) buffer_len > sizeof (part_header_t))) { - header = (part_header_t *) buffer; + uint16_t pkg_length; + uint16_t pkg_type; + + memcpy ((void *) &pkg_type, + (void *) buffer, + sizeof (pkg_type)); + memcpy ((void *) &pkg_length, + (void *) (buffer + sizeof (pkg_type)), + sizeof (pkg_length)); - if (ntohs (header->length) > buffer_len) + pkg_length = ntohs (pkg_length); + pkg_type = ntohs (pkg_type); + + if (pkg_length > buffer_len) break; - /* Assure that this loop terminates eventually */ - if (ntohs (header->length) < 4) + /* Ensure that this loop terminates eventually */ + if (pkg_length < (2 * sizeof (uint16_t))) break; - if (ntohs (header->type) == TYPE_VALUES) + if (pkg_type == TYPE_VALUES) { status = parse_part_values (&buffer, &buffer_len, &vl.values, &vl.values_len); @@@ -646,12 -737,9 +740,12 @@@ uint64_t tmp = 0; status = parse_part_number (&buffer, &buffer_len, &tmp); if (status == 0) + { vl.time = (time_t) tmp; + n.time = (time_t) tmp; + } } - else if (ntohs (header->type) == TYPE_INTERVAL) + else if (pkg_type == TYPE_INTERVAL) { uint64_t tmp = 0; status = parse_part_number (&buffer, &buffer_len, &tmp); @@@ -662,96 -750,26 +756,82 @@@ { status = parse_part_string (&buffer, &buffer_len, vl.host, sizeof (vl.host)); + strncpy (n.host, vl.host, sizeof (n.host)); + n.host[sizeof (n.host) - 1] = '\0'; - DEBUG ("network plugin: parse_packet: vl.host = %s", - vl.host); } - else if (ntohs (header->type) == TYPE_PLUGIN) + else if (pkg_type == TYPE_PLUGIN) { status = parse_part_string (&buffer, &buffer_len, vl.plugin, sizeof (vl.plugin)); + strncpy (n.plugin, vl.plugin, sizeof (n.plugin)); + n.plugin[sizeof (n.plugin) - 1] = '\0'; - DEBUG ("network plugin: parse_packet: vl.plugin = %s", - vl.plugin); } - else if (ntohs (header->type) == TYPE_PLUGIN_INSTANCE) + else if (pkg_type == TYPE_PLUGIN_INSTANCE) { status = parse_part_string (&buffer, &buffer_len, - vl.plugin_instance, sizeof (vl.plugin_instance)); + vl.plugin_instance, + sizeof (vl.plugin_instance)); + strncpy (n.plugin_instance, vl.plugin_instance, + sizeof (n.plugin_instance)); + n.plugin_instance[sizeof (n.plugin_instance) - 1] = '\0'; - DEBUG ("network plugin: parse_packet: " - "vl.plugin_instance = %s", - vl.plugin_instance); } - else if (ntohs (header->type) == TYPE_TYPE) + else if (pkg_type == TYPE_TYPE) { status = parse_part_string (&buffer, &buffer_len, type, sizeof (type)); + strncpy (n.type, type, sizeof (n.type)); + n.type[sizeof (n.type) - 1] = '\0'; - DEBUG ("network plugin: parse_packet: type = %s", - type); } - else if (ntohs (header->type) == TYPE_TYPE_INSTANCE) + else if (pkg_type == TYPE_TYPE_INSTANCE) { status = parse_part_string (&buffer, &buffer_len, - vl.type_instance, sizeof (vl.type_instance)); + vl.type_instance, + sizeof (vl.type_instance)); + strncpy (n.type_instance, vl.type_instance, + sizeof (n.type_instance)); + n.type_instance[sizeof (n.type_instance) - 1] = '\0'; - DEBUG ("network plugin: parse_packet: " - "vl.type_instance = %s", - vl.type_instance); + } - else if (ntohs (header->type) == TYPE_MESSAGE) ++ else if (pkg_type == TYPE_MESSAGE) + { + status = parse_part_string (&buffer, &buffer_len, + n.message, sizeof (n.message)); - DEBUG ("network plugin: parse_packet: n.message = %s", - n.message); + + if ((n.severity != NOTIF_FAILURE) + && (n.severity != NOTIF_WARNING) + && (n.severity != NOTIF_OKAY)) + { + INFO ("network plugin: " + "Ignoring notification with " - "unknown severity %s.", ++ "unknown severity %i.", + n.severity); + } + else if (n.time <= 0) + { + INFO ("network plugin: " + "Ignoring notification with " + "time == 0."); + } + else if (strlen (n.message) <= 0) + { + INFO ("network plugin: " + "Ignoring notification with " + "an empty message."); + } + else + { + /* + * TODO: Let this do a separate thread so that + * no packets are lost if this takes too long. + */ + plugin_dispatch_notification (&n); + } + } - else if (ntohs (header->type) == TYPE_SEVERITY) ++ else if (pkg_type == TYPE_SEVERITY) + { + uint64_t tmp = 0; + status = parse_part_number (&buffer, &buffer_len, &tmp); + if (status == 0) + n.severity = (int) tmp; } else {