Merge branch 'collectd-4.5' into collectd-4.6
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 22 Feb 2009 18:31:49 +0000 (19:31 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 22 Feb 2009 18:32:33 +0000 (19:32 +0100)
Conflicts:

ChangeLog
version-gen.sh

The changes made in b6612126 and reverted in 5fa56b89 are retained in
collectd-4.6.

1  2 
ChangeLog
src/ipmi.c

diff --combined ChangeLog
+++ b/ChangeLog
@@@ -1,74 -1,15 +1,86 @@@
 +2009-02-16, Version 4.6.0
 +      * collectd: Added the `filter chain' infrastructure, which allows the
 +        user to use `matches' and `targets' to control value processing.
 +      * collectd: The new `-T' command line argument allows more in-depth
 +        testing of a configuration. Thanks to Doug MacEachern for the patch.
 +      * collectd-nagios: The Nagios integration command has been updated to
 +        use libcollectdclient. The `percentage' aggregation function has
 +        been added. Thanks to Fabian Linzberger for the patch.
 +      * libcollectdclient: A library which abstracts communication with the
 +        unixsock plugin for clients has been added.
 +      * regex match: Match values by their identifies using regular
 +        expressions.
 +      * timediff match: Match for values with an invalid timestamp.
 +      * value match: Select values by their data sources' values.
 +      * notification target: Create and dispatch a notification.
 +      * replace target: Replace parts of an identifier using regular
 +        expressions.
 +      * set target: Set (overwrite) entire parts of an identifier.
 +      * bind plugin: This new plugin uses the new HTTP/XML interface to BIND
 +        statistics, allowing very detailed name server statistics. Thanks to
 +        Bruno Prémont for this plugin.
 +      * cpu plugin: Report `interrupt' separately when using
 +        sysctlbyname(3) (used under *BSD). Support for sysctl(3), for
 +        example for native OpenBSD support, has been added. Thanks to Simon
 +        Kuhnle for the patch.
 +      * csv plugin: Make it possible to write values to STDOUT instead of
 +        files. This is meant for testing purposes mostly. The output written
 +        to STDOUT is compatible with the exec plugin. Thanks to Doug
 +        MacEachern for the patch.
 +      * curl plugin: This new plugin can be used to read web pages and parse
 +        them using the same mechanism that's used in the tail plugin.
 +      * dbi plugin: This new plugin allows you to connect to a variety of
 +        relational databases and use SQL to gather custom statistics from
 +        it. It is similar to the already existing PostgreSQL plugin but uses
 +        libdbi to communicate with the database(s).
 +      * interface plugin: Use the ignorelist framework when selecting /
 +        ignoring interfaces. This allows one to use regular expressions to
 +        select interfaces, too.
 +      * ipmi plugin: Handle temporary IPMI error conditions more gracefully.
 +        Thanks to Bruno Prémont for this patch.
 +      * memcached plugin: Add hit-ratio metric. Thanks to Doug MacEachern
 +        for the patch.
 +      * mysql plugin: Allow connecting to a database via the UNIX domain
 +        socket, too. Thanks to Mirko Buffoni for the patch.
 +      * network plugin: Further performance improvements for the receive
 +        code. This hopefully will help very large setups.
 +      * openvpn plugin: This new plugin collects statistics provided by the
 +        OpenVPN daemon. Thanks to Doug MacEachern for the patch.
 +      * oracle plugin: This new plugin allows you to connect to an Oracle
 +        database and use SQL to gather custom statistics from it. It is
 +        similar to the already existing PostgreSQL plugin.
 +      * perl plugin: Compatibility fixes for broken versions of Perl 5.10
 +        have been added.
 +      * perl plugin: Export the newly added plugin_write() to Perl plugins.
 +      * perl plugin: Added support for `notification meta data'.
 +      * perl plugin: Added support for the `filter chain' infrastructure by
 +        allowing plugins to register `matches' and `targets'.
 +      * postgresql plugin: The preferred configuration syntax has been
 +        updated to be in line with the syntax used by the new dbi and oracle
 +        plugins. The compatibility code for the old syntax is present.
 +        Support for the new `Result' blocks and the interval parameter has
 +        been added.
 +      * processes plugin: Stacksize and virtual memory usage statistics have
 +        been added. Portability fixes.
 +      * rrdcached plugin: This new plugin uses the (still in development)
 +        RRD accelerator daemon, rrdcached. This daemon works very similar to
 +        the original rrdtool plugin of collectd, but adds some more nice
 +        features.
 +      * swap plugin: Code for OpenBSD (and possibly other *BSDs) has been
 +        added.
 +
+ 2009-02-22, Version 4.5.3
+       * build system: The check for libupsclient even when `pkg-config' is
+         not available.
+       * collectd: Fix error handling in the global cache.
+       * Collectd::Unixsock: Error handling has been improved.
+       * ascent plugin: Fix a memory leak. Thanks to Bruno Prémont for his
+         patch.
+       * ipmi plugin: Fix an off-by-one error which could cause segmentation
+         faults. Thanks to Peter Holik for his patch.
+       * tcpconns plugin: An endianness problem has been fixed in the *BSD
+         code. Thanks to "thated" for reporting this.
  2009-01-02, Version 4.5.2
        * build system: Check for `mysql.h' and `mysql/mysql.h', since the
          file may be in both locations, especially when the database was
diff --combined src/ipmi.c
@@@ -111,9 -111,9 +111,9 @@@ static int sensor_list_remove (ipmi_sen
  static void sensor_read_handler (ipmi_sensor_t *sensor,
      int err,
      enum ipmi_value_present_e value_present,
 -    unsigned int raw_value,
 +    unsigned int __attribute__((unused)) raw_value,
      double value,
 -    ipmi_states_t *states,
 +    ipmi_states_t __attribute__((unused)) *states,
      void *user_data)
  {
    value_t values[1];
          }
        }
      }
 +    else if (IPMI_IS_IPMI_ERR(err) && IPMI_GET_IPMI_ERR(err) == IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC)
 +    {
 +      INFO ("ipmi plugin: sensor_read_handler: Sensor %s not ready",
 +          list_item->sensor_name);
 +    }
      else
      {
 -      INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
 -          "because it failed with status %#x.",
 -          list_item->sensor_name, err);
 +      if (IPMI_IS_IPMI_ERR(err))
 +        INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
 +            "because it failed with IPMI error %#x.",
 +            list_item->sensor_name, IPMI_GET_IPMI_ERR(err));
 +      else if (IPMI_IS_OS_ERR(err))
 +        INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
 +            "because it failed with OS error %#x.",
 +            list_item->sensor_name, IPMI_GET_OS_ERR(err));
 +      else if (IPMI_IS_RMCPP_ERR(err))
 +        INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
 +            "because it failed with RMCPP error %#x.",
 +            list_item->sensor_name, IPMI_GET_RMCPP_ERR(err));
 +      else if (IPMI_IS_SOL_ERR(err))
 +        INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
 +            "because it failed with RMCPP error %#x.",
 +            list_item->sensor_name, IPMI_GET_SOL_ERR(err));
 +      else
 +        INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
 +            "because it failed with error %#x. of class %#x",
 +            list_item->sensor_name, err & 0xff, err & 0xffffff00);
        sensor_list_remove (sensor);
      }
      return;
  
    vl.values = values;
    vl.values_len = 1;
 -  vl.time = time (NULL);
  
    sstrncpy (vl.host, hostname_g, sizeof (vl.host));
    sstrncpy (vl.plugin, "ipmi", sizeof (vl.plugin));
@@@ -234,35 -213,54 +234,54 @@@ static int sensor_list_add (ipmi_sensor
    c_ipmi_sensor_list_t *list_item;
    c_ipmi_sensor_list_t *list_prev;
  
+   char buffer[DATA_MAX_NAME_LEN];
+   const char *entity_id_string;
    char sensor_name[DATA_MAX_NAME_LEN];
    char *sensor_name_ptr;
-   int sensor_type, len;
+   int sensor_type;
    const char *type;
    ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor);
  
    sensor_id = ipmi_sensor_convert_to_id (sensor);
  
-   memset (sensor_name, 0, sizeof (sensor_name));
-   ipmi_sensor_get_name (sensor, sensor_name, sizeof (sensor_name));
-   sensor_name[sizeof (sensor_name) - 1] = 0;
+   memset (buffer, 0, sizeof (buffer));
+   ipmi_sensor_get_name (sensor, buffer, sizeof (buffer));
+   buffer[sizeof (buffer) - 1] = 0;
  
-   len = DATA_MAX_NAME_LEN - strlen(sensor_name);
-   strncat(sensor_name, " ", len--);
-   strncat(sensor_name, ipmi_entity_get_entity_id_string(ent), len);
+   entity_id_string = ipmi_entity_get_entity_id_string (ent);
  
-   sensor_name_ptr = strstr (sensor_name, ").");
-   if (sensor_name_ptr == NULL)
-     sensor_name_ptr = sensor_name;
+   if (entity_id_string == NULL)
+     sstrncpy (sensor_name, buffer, sizeof (sensor_name));
    else
-   {
-     char *sensor_name_ptr_id = strstr (sensor_name, "(");
+     ssnprintf (sensor_name, sizeof (sensor_name),
+         "%s %s", buffer, entity_id_string);
  
+   sstrncpy (buffer, sensor_name, sizeof (buffer));
+   sensor_name_ptr = strstr (buffer, ").");
+   if (sensor_name_ptr != NULL)
+   {
+     /* If name is something like "foo (123).bar",
+      * change that to "bar (123)".
+      * Both, sensor_name_ptr and sensor_id_ptr point to memory within the
+      * `buffer' array, which holds a copy of the current `sensor_name'. */
+     char *sensor_id_ptr;
+     /* `sensor_name_ptr' points to ").bar". */
+     sensor_name_ptr[1] = 0;
+     /* `buffer' holds "foo (123)\0bar\0". */
      sensor_name_ptr += 2;
-     len = DATA_MAX_NAME_LEN - strlen(sensor_name);
-     strncat(sensor_name, " ", len--);
-     strncat(sensor_name, sensor_name_ptr_id, 
-       MIN(sensor_name_ptr - sensor_name_ptr_id - 1, len));
+     /* `sensor_name_ptr' now points to "bar". */
+     sensor_id_ptr = strstr (buffer, "(");
+     if (sensor_id_ptr != NULL)
+     {
+       /* `sensor_id_ptr' now points to "(123)". */
+       ssnprintf (sensor_name, sizeof (sensor_name),
+           "%s %s", sensor_name_ptr, sensor_id_ptr); 
+     }
+     /* else: don't touch sensor_name. */
    }
+   sensor_name_ptr = sensor_name;
  
    /* Both `ignorelist' and `plugin_instance' may be NULL. */
    if (ignorelist_match (ignorelist, sensor_name_ptr) != 0)
@@@ -459,9 -457,9 +478,9 @@@ static int sensor_list_remove_all (void
   * Entity handlers
   */
  static void entity_sensor_update_handler (enum ipmi_update_e op,
 -    ipmi_entity_t *entity,
 +    ipmi_entity_t __attribute__((unused)) *entity,
      ipmi_sensor_t *sensor,
 -    void *user_data)
 +    void __attribute__((unused)) *user_data)
  {
    /* TODO: Ignore sensors we cannot read */
  
   * Domain handlers
   */
  static void domain_entity_update_handler (enum ipmi_update_e op,
 -    ipmi_domain_t *domain,
 +    ipmi_domain_t __attribute__((unused)) *domain,
      ipmi_entity_t *entity,
 -    void *user_data)
 +    void __attribute__((unused)) *user_data)
  {
    int status;
  
@@@ -574,7 -572,7 +593,7 @@@ static int thread_init (os_handler_t **
    return (0);
  } /* int thread_init */
  
 -static void *thread_main (void *user_data)
 +static void *thread_main (void __attribute__((unused)) *user_data)
  {
    int status;
    os_handler_t *os_handler = NULL;