Merge branch 'collectd-5.5'
authorMarc Fournier <marc.fournier@camptocamp.com>
Fri, 11 Sep 2015 21:29:08 +0000 (23:29 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 11 Sep 2015 21:29:08 +0000 (23:29 +0200)
1  2 
configure.ac
src/collectd.conf.pod
src/snmp.c

diff --combined configure.ac
  AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
  # }}}
  
 +# --with-libmosquitto {{{
 +with_libmosquitto_cppflags=""
 +with_libmosquitto_libs="-lmosquitto"
 +AC_ARG_WITH(libmosquitto, [AS_HELP_STRING([--with-libmosquitto@<:@=PREFIX@:>@], [Path to libmosquitto.])],
 +[
 +      if test "x$withval" != "xno" && test "x$withval" != "xyes"
 +      then
 +              with_libmosquitto_cppflags="-I$withval/include"
 +              with_libmosquitto_libs="-L$withval/lib -lmosquitto"
 +              with_libmosquitto="yes"
 +      else
 +              with_libmosquitto="$withval"
 +      fi
 +],
 +[
 +      with_libmosquitto="yes"
 +])
 +if test "x$with_libmosquitto" = "xyes"
 +then
 +      SAVE_CPPFLAGS="$CPPFLAGS"
 +      CPPFLAGS="$with_libmosquitto_cppflags"
 +
 +      AC_CHECK_HEADERS(mosquitto.h, [with_libmosquitto="yes"], [with_libmosquitto="no (mosquitto.h not found)"])
 +
 +      CPPFLAGS="$SAVE_CPPFLAGS"
 +fi
 +if test "x$with_libmosquitto" = "xyes"
 +then
 +      SAVE_LDFLAGS="$LDFLAGS"
 +      SAVE_CPPFLAGS="$CPPFLAGS"
 +      LDFLAGS="$with_libmosquitto_libs"
 +      CPPFLAGS="$with_libmosquitto_cppflags"
 +
 +      AC_CHECK_LIB(mosquitto, mosquitto_connect, [with_libmosquitto="yes"], [with_libmosquitto="no (libmosquitto not found)"])
 +
 +      LDFLAGS="$SAVE_LDFLAGS"
 +      CPPFLAGS="$SAVE_CPPFLAGS"
 +fi
 +if test "x$with_libmosquitto" = "xyes"
 +then
 +      BUILD_WITH_LIBMOSQUITTO_CPPFLAGS="$with_libmosquitto_cppflags"
 +      BUILD_WITH_LIBMOSQUITTO_LIBS="$with_libmosquitto_libs"
 +      AC_SUBST(BUILD_WITH_LIBMOSQUITTO_CPPFLAGS)
 +      AC_SUBST(BUILD_WITH_LIBMOSQUITTO_LIBS)
 +fi
 +# }}}
 +
  # --with-libmysql {{{
  with_mysql_config="mysql_config"
  with_mysql_cflags=""
@@@ -2738,7 -2691,7 +2738,7 @@@ AC_ARG_WITH(libmysql, [AS_HELP_STRING([
  ])
  if test "x$with_libmysql" = "xyes"
  then
-       with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
+       with_mysql_cflags=`$with_mysql_config --include 2>/dev/null`
        mysql_config_status=$?
  
        if test $mysql_config_status -ne 0
        then
                with_libmysql="no ($with_mysql_config failed)"
        else
-               AC_CHECK_LIB(mysqlclient, mysql_init,
-                [with_libmysql="yes"],
-                [with_libmysql="no (symbol 'mysql_init' not found)"],
-                [$with_mysql_libs])
-               AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
+               SAVE_CPPFLAGS="$CPPFLAGS"
+               CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
+               SAVE_LIBS="$LIBS"
+               LIBS="$with_mysql_libs"
+               AC_SEARCH_LIBS([mysql_get_server_version],
+                [],
                 [with_libmysql="yes"],
                 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
-                [$with_mysql_libs])
+                [])
+               CPPFLAGS="$SAVE_CPPFLAGS"
+               LIBS="$SAVE_LIBS"
        fi
  fi
  if test "x$with_libmysql" = "xyes"
@@@ -5246,7 -5201,6 +5248,7 @@@ collectd features:]
  AC_COLLECTD([debug],     [enable],  [feature], [debugging])
  AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
  AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
 +AC_COLLECTD([werror],    [disable], [feature], [building with -Werror])
  
  dependency_warning="no"
  dependency_error="no"
@@@ -5297,7 -5251,6 +5299,7 @@@ plugin_vmem="no
  plugin_vserver="no"
  plugin_wireless="no"
  plugin_zfs_arc="no"
 +plugin_zone="no"
  plugin_zookeeper="no"
  
  # Linux
  
  if test "x$ac_system" = "xFreeBSD"
  then
 +      plugin_disk="yes"
        plugin_zfs_arc="yes"
  fi
  
@@@ -5397,7 -5349,6 +5399,7 @@@ the
        plugin_processes="yes"
        plugin_uptime="yes"
        plugin_zfs_arc="yes"
 +      plugin_zone="yes"
  fi
  
  if test "x$with_devinfo$with_kstat" = "xyesyes"
@@@ -5688,7 -5639,6 +5690,7 @@@ AC_PLUGIN([memcached],   [yes]
  AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
  AC_PLUGIN([mic],         [$with_mic],          [Intel Many Integrated Core stats])
  AC_PLUGIN([modbus],      [$with_libmodbus],    [Modbus plugin])
 +AC_PLUGIN([mqtt],        [$with_libmosquitto], [MQTT output plugin])
  AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
  AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
  AC_PLUGIN([netapp],      [$with_libnetapp],    [NetApp plugin])
@@@ -5764,7 -5714,6 +5766,7 @@@ AC_PLUGIN([write_sensu], [yes]
  AC_PLUGIN([write_tsdb],  [yes],                [TSDB output plugin])
  AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
  AC_PLUGIN([zfs_arc],     [$plugin_zfs_arc],    [ZFS ARC statistics])
 +AC_PLUGIN([zone],        [$plugin_zone],       [Solaris container statistics])
  AC_PLUGIN([zookeeper],   [yes],              [Zookeeper statistics])
  
  dnl Default configuration file
@@@ -5916,13 -5865,6 +5918,13 @@@ AC_SUBST(LCC_VERSION_STRING
  
  AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
  
 +AM_CFLAGS="-Wall"
 +if test "x$enable_werror" != "xno"
 +then
 +        AM_CFLAGS="$AM_CFLAGS -Werror"
 +fi
 +AC_SUBST([AM_CFLAGS])
 +
  AC_CONFIG_FILES([Makefile src/Makefile src/daemon/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile])
  AC_OUTPUT
  
  cat <<EOF;
  
  Configuration:
 +  Build:
 +    Platform  . . . . . . $ac_system
 +    CC  . . . . . . . . . $CC
 +    CFLAGS  . . . . . . . $AM_CFLAGS $CFLAGS
 +    CPP . . . . . . . . . $CPP
 +    CPPFLAGS  . . . . . . $CPPFLAGS
 +    LD  . . . . . . . . . $LD
 +    LDFLAGS . . . . . . . $LDFLAGS
 +    YACC  . . . . . . . . $YACC
 +    YFLAGS  . . . . . . . $YFLAGS
 +
    Libraries:
      intel mic . . . . . . $with_mic
      libaquaero5 . . . . . $with_libaquaero5
      libmnl  . . . . . . . $with_libmnl
      libmodbus . . . . . . $with_libmodbus
      libmongoc . . . . . . $with_libmongoc
 +    libmosquitto  . . . . $with_libmosquitto
      libmysql  . . . . . . $with_libmysql
      libnetapp . . . . . . $with_libnetapp
      libnetsnmp  . . . . . $with_libnetsnmp
      memory  . . . . . . . $enable_memory
      mic . . . . . . . . . $enable_mic
      modbus  . . . . . . . $enable_modbus
 +    mqtt  . . . . . . . . $enable_mqtt
      multimeter  . . . . . $enable_multimeter
      mysql . . . . . . . . $enable_mysql
      netapp  . . . . . . . $enable_netapp
      write_tsdb  . . . . . $enable_write_tsdb
      xmms  . . . . . . . . $enable_xmms
      zfs_arc . . . . . . . $enable_zfs_arc
 +    zone  . . . . . . . . $enable_zone
      zookeeper . . . . . . $enable_zookeeper
  
  EOF
diff --combined src/collectd.conf.pod
@@@ -130,15 -130,6 +130,15 @@@ Sets a plugin-specific interval for col
  global B<Interval> setting. If a plugin provides own support for specifying an
  interval, that setting will take precedence.
  
 +=item B<FlushInterval> I<Seconds>
 +
 +Specifies the the interval, in seconds, to call the flush callback if it's
 +defined in this plugin. By default, this is disabled
 +
 +=item B<FlushTimeout> I<Seconds>
 +
 +Specifies the value of the timeout argument of the flush callback.
 +
  =back
  
  =item B<AutoLoadPlugin> B<false>|B<true>
@@@ -513,9 -504,7 +513,9 @@@ are disabled by default
  The I<AMQP plugin> can be used to communicate with other instances of
  I<collectd> or third party applications using an AMQP message broker. Values
  are sent to or received from the broker, which handles routing, queueing and
 -possibly filtering or messages.
 +possibly filtering out messages.
 +
 +B<Synopsis:>
  
   <Plugin "amqp">
     # Send values to an AMQP broker
@@@ -813,22 -802,12 +813,22 @@@ B<apcupsd> can handle it
  
  TCP-Port to connect to. Defaults to B<3551>.
  
 -=item B<ReportSeconds> B<true|false>
 +=item B<ReportSeconds> B<true>|B<false>
  
  If set to B<true>, the time reported in the C<timeleft> metric will be
  converted to seconds. This is the recommended setting. If set to B<false>, the
  default for backwards compatibility, the time will be reported in minutes.
  
 +=item B<PersistentConnection> B<true>|B<false>
 +
 +By default, the plugin will try to keep the connection to UPS open between
 +reads. Since this appears to be somewhat brittle (I<apcupsd> appears to close
 +the connection due to inactivity quite quickly), the plugin will try to detect
 +this problem and switch to an open-read-close mode in such cases.
 +
 +You can instruct the plugin to close the connection after each read by setting
 +this option to B<false>.
 +
  =back
  
  =head2 Plugin C<aquaero>
@@@ -1827,7 -1806,6 +1827,7 @@@ than those of other plugins. It usuall
      </Query>
      <Database "product_information">
        Driver "mysql"
 +      Interval 120
        DriverOption "host" "localhost"
        DriverOption "username" "collectd"
        DriverOption "password" "aZo6daiw"
@@@ -2007,11 -1985,6 +2007,11 @@@ the daemon. Other than that, that name 
  
  =over 4
  
 +=item B<Interval> I<Interval>
 +
 +Sets the interval (in seconds) in which the values will be collected from this
 +database. By default the global B<Interval> setting will be used.
 +
  =item B<Driver> I<Driver>
  
  Specifies the driver to use to connect to the database. In many cases those
@@@ -3241,114 -3214,6 +3241,114 @@@ B<Collect> option is mandatory
  
  =back
  
 +=head2 Plugin C<mqtt>
 +
 +The I<MQTT plugin> can send metrics to MQTT (B<Publish> blocks) and receive
 +values from MQTT (B<Subscribe> blocks).
 +
 +B<Synopsis:>
 +
 + <Plugin mqtt>
 +   <Publish "name">
 +     Host "mqtt.example.com"
 +     Prefix "collectd"
 +   </Publish>
 +   <Subscribe "name">
 +     Host "mqtt.example.com"
 +     Topic "collectd/#"
 +   </Subscribe>
 + </Plugin>
 +
 +The plugin's configuration is in B<Publish> and/or B<Subscribe> blocks,
 +configuring the sending and receiving direction respectively. The plugin will
 +register a write callback named C<mqtt/I<name>> where I<name> is the string
 +argument given to the B<Publish> block. Both types of blocks share many but not
 +all of the following options. If an option is valid in only one of the blocks,
 +it will be mentioned explicitly.
 +
 +B<Options:>
 +
 +=over 4
 +
 +=item B<Host> I<Hostname>
 +
 +Hostname of the MQTT broker to connect to.
 +
 +=item B<Port> I<Service>
 +
 +Port number or service name of the MQTT broker to connect to.
 +
 +=item B<User> I<UserName>
 +
 +Username used when authenticating to the MQTT broker.
 +
 +=item B<Password> I<Password>
 +
 +Password used when authenticating to the MQTT broker.
 +
 +=item B<ClientId> I<ClientId>
 +
 +MQTT client ID to use. Defaults to the hostname used by I<collectd>.
 +
 +=item B<QoS> [B<0>-B<2>]
 +
 +Sets the I<Quality of Service>, with the values C<0>, C<1> and C<2> meaning:
 +
 +=over 4
 +
 +=item B<0>
 +
 +At most once
 +
 +=item B<1>
 +
 +At least once
 +
 +=item B<2>
 +
 +Exactly once
 +
 +=back
 +
 +In B<Publish> blocks, this option determines the QoS flag set on outgoing
 +messages and defaults to B<0>. In B<Subscribe> blocks, determines the maximum
 +QoS setting the client is going to accept and defaults to B<2>. If the QoS flag
 +on a message is larger than the maximum accepted QoS of a subscriber, the
 +message's QoS will be downgraded.
 +
 +=item B<Prefix> I<Prefix> (Publish only)
 +
 +This plugin will use one topic per I<value list> which will looks like a path.
 +I<Prefix> is used as the first path element and defaults to B<collectd>.
 +
 +An example topic name would be:
 +
 + collectd/cpu-0/cpu-user
 +
 +=item B<Retain> B<false>|B<true> (Publish only)
 +
 +Controls whether the MQTT broker will retain (keep a copy of) the last message
 +sent to each topic and deliver it to new subscribers. Defaults to B<false>.
 +
 +=item B<StoreRates> B<true>|B<false> (Publish only)
 +
 +Controls whether C<DERIVE> and C<COUNTER> metrics are converted to a I<rate>
 +before sending. Defaults to B<true>.
 +
 +=item B<CleanSession> B<true>|B<false> (Subscribe only)
 +
 +Controls whether the MQTT "cleans" the session up after the subscriber
 +disconnects or if it maintains the subscriber's subscriptions and all messages
 +that arrive while the subscriber is disconnected. Defaults to B<true>.
 +
 +=item B<Topic> I<TopicName> (Subscribe only)
 +
 +Configures the topic(s) to subscribe to. You can use the single level C<+> and
 +multi level C<#> wildcards. Defaults to B<collectd/#>, i.e. all topics beneath
 +the B<collectd> branch.
 +
 +=back
 +
  =head2 Plugin C<mysql>
  
  The C<mysql plugin> requires B<mysqlclient> to be installed. It connects to
@@@ -4629,16 -4494,6 +4629,16 @@@ The following options are accepted with
  Sets the URL to use to connect to the I<OpenLDAP> server. This option is
  I<mandatory>.
  
 +=item B<BindDN> I<BindDN>
 +
 +Name in the form of an LDAP distinguished name intended to be used for 
 +authentication. Defaults to empty string to establish an anonymous authorization.
 +
 +=item B<Password> I<Password>
 +
 +Password for simple bind authentication. If this option is not set, 
 +unauthenticated bind operation is used.
 +
  =item B<StartTLS> B<true|false>
  
  Defines whether TLS must be used when connecting to the I<OpenLDAP> server.
@@@ -5567,10 -5422,6 +5567,10 @@@ dispatched to the daemon using the spec
  allows to "group" several processes together. I<name> must not contain
  slashes.
  
 +=item B<CollectContextSwitch> I<Boolean>
 +
 +Collect context switch of the process.
 +
  =back
  
  =head2 Plugin C<protocols>
@@@ -7147,6 -6998,10 +7147,10 @@@ by the hypervisor, which is equal to se
  
  B<uuid> means use the guest's UUID.
  
+ You can also specify combinations of these fields. For example B<name uuid>
+ means to concatenate the guest name and UUID (with a literal colon character
+ between, thus I<"foo:1234-1234-1234-1234">).
  =back
  
  =head2 Plugin C<vmem>
@@@ -7488,10 -7343,6 +7492,10 @@@ complete. When this limit is reached, t
  all the data in the current send buffer will probably be lost. Defaults to 0,
  which means the connection never times out.
  
 +=item B<LogHttpError> B<false>|B<true>
 +
 +Enables printing of HTTP error code to log. Turned off by default.
 +
  The C<write_http> plugin regularly submits the collected values to the HTTP
  server. How frequently this happens depends on how much data you are collecting
  and the size of B<BufferSize>. The optimal value to set B<Timeout> to is
@@@ -7618,18 -7469,14 +7622,18 @@@ Synopsis
          Host "localhost"
          Port "6379"
          Timeout 1000
 +        Prefix "collectd/"
 +        Database 1
      </Node>
    </Plugin>
  
  Values are submitted to I<Sorted Sets>, using the metric name as the key, and
  the timestamp as the score. Retrieving a date range can then be done using the
 -C<ZRANGEBYSCORE> I<Redis> command. Additionnally, all the identifiers of these
 -I<Sorted Sets> are kept in a I<Set> called C<collectd/values> and can be
 -retrieved using the C<SMEMBERS> I<Redis> command. See
 +C<ZRANGEBYSCORE> I<Redis> command. Additionally, all the identifiers of these
 +I<Sorted Sets> are kept in a I<Set> called C<collectd/values> (or
 +C<${prefix}/values> if the B<Prefix> option was specified) and can be retrieved
 +using the C<SMEMBERS> I<Redis> command. You can specify the database to use 
 +with the B<Database> parameter (default is C<0>). See
  L<http://redis.io/commands#sorted_set> and L<http://redis.io/commands#set> for
  details.
  
@@@ -7645,9 -7492,9 +7649,9 @@@ options are available
  =item B<Node> I<Nodename>
  
  The B<Node> block identifies a new I<Redis> node, that is a new I<Redis>
 -instance running in an specified host and port. The name for node is a
 +instance running on a specified host and port. The node name is a
  canonical identifier which is used as I<plugin instance>. It is limited to
 -64E<nbsp>characters in length.
 +51E<nbsp>characters in length.
  
  =item B<Host> I<Hostname>
  
@@@ -7664,17 -7511,6 +7668,17 @@@ that numerical port numbers must be giv
  
  The B<Timeout> option sets the socket connection timeout, in milliseconds.
  
 +=item B<Prefix> I<Prefix>
 +
 +Prefix used when constructing the name of the I<Sorted Sets> and the I<Set>
 +containing all metrics. Defaults to C<collectd/>, so metrics will have names
 +like C<collectd/cpu-0/cpu-user>. When setting this to something different, it
 +is recommended but not required to include a trailing slash in I<Prefix>.
 +
 +=item B<Database> I<Index>
 +
 +This index selects the redis database to use for writing operations. Defaults to C<0>.
 +
  =back
  
  =head2 Plugin C<write_riemann>
diff --combined src/snmp.c
@@@ -61,7 -61,7 +61,7 @@@ struct data_definition_
    instance_t instance;
    char *instance_prefix;
    oid_t *values;
 -  int values_len;
 +  size_t values_len;
    double scale;
    double shift;
    struct data_definition_s *next;
@@@ -313,7 -313,7 +313,7 @@@ static int csnmp_config_add_data_value
    dd->values = (oid_t *) malloc (sizeof (oid_t) * ci->values_num);
    if (dd->values == NULL)
      return (-1);
 -  dd->values_len = ci->values_num;
 +  dd->values_len = (size_t) ci->values_num;
  
    for (i = 0; i < ci->values_num; i++)
    {
@@@ -459,7 -459,7 +459,7 @@@ static int csnmp_config_add_data (oconf
      return (-1);
    }
  
 -  DEBUG ("snmp plugin: dd = { name = %s, type = %s, is_table = %s, values_len = %i }",
 +  DEBUG ("snmp plugin: dd = { name = %s, type = %s, is_table = %s, values_len = %zu }",
        dd->name, dd->type, (dd->is_table != 0) ? "true" : "false", dd->values_len);
  
    if (data_head == NULL)
@@@ -645,6 -645,7 +645,6 @@@ static int csnmp_config_add_host (oconf
    /* Registration stuff. */
    char cb_name[DATA_MAX_NAME_LEN];
    user_data_t cb_data;
 -  struct timespec cb_interval;
  
    hd = (host_definition_t *) malloc (sizeof (host_definition_t));
    if (hd == NULL)
    cb_data.data = hd;
    cb_data.free_func = csnmp_host_definition_destroy;
  
 -  CDTIME_T_TO_TIMESPEC (hd->interval, &cb_interval);
 -
    status = plugin_register_complex_read (/* group = */ NULL, cb_name,
 -      csnmp_read_host, /* interval = */ &cb_interval,
 -      /* user_data = */ &cb_data);
 +      csnmp_read_host, hd->interval, /* user_data = */ &cb_data);
    if (status != 0)
    {
      ERROR ("snmp plugin: Registering complex read function failed.");
@@@ -1049,10 -1053,6 +1049,10 @@@ static value_t csnmp_value_list_to_valu
    return (ret);
  } /* value_t csnmp_value_list_to_value */
  
 +/* csnmp_strvbcopy_hexstring converts the bit string contained in "vb" to a hex
 + * representation and writes it to dst. Returns zero on success and ENOMEM if
 + * dst is not large enough to hold the string. dst is guaranteed to be
 + * nul-terminated. */
  static int csnmp_strvbcopy_hexstring (char *dst, /* {{{ */
      const struct variable_list *vb, size_t dst_size)
  {
    size_t buffer_free;
    size_t i;
  
 +  dst[0] = 0;
 +
    buffer_ptr = dst;
    buffer_free = dst_size;
  
  
      status = snprintf (buffer_ptr, buffer_free,
          (i == 0) ? "%02x" : ":%02x", (unsigned int) vb->val.bitstring[i]);
 +    assert (status >= 0);
  
 -    if (status >= buffer_free)
 +    if (((size_t) status) >= buffer_free) /* truncated */
      {
 -      buffer_ptr += (buffer_free - 1);
 -      *buffer_ptr = 0;
 -      return (dst_size + (buffer_free - status));
 +      dst[dst_size - 1] = 0;
 +      return ENOMEM;
      }
      else /* if (status < buffer_free) */
      {
 -      buffer_ptr += status;
 -      buffer_free -= status;
 +      buffer_ptr  += (size_t) status;
 +      buffer_free -= (size_t) status;
      }
    }
  
 -  return ((int) (dst_size - buffer_free));
 +  return 0;
  } /* }}} int csnmp_strvbcopy_hexstring */
  
 +/* csnmp_strvbcopy copies the octet string or bit string contained in vb to
 + * dst. If non-printable characters are detected, it will switch to a hex
 + * representation of the string. Returns zero on success, EINVAL if vb does not
 + * contain a string and ENOMEM if dst is not large enough to contain the
 + * string. */
  static int csnmp_strvbcopy (char *dst, /* {{{ */
      const struct variable_list *vb, size_t dst_size)
  {
      dst[i] = src[i];
    }
    dst[num_chars] = 0;
 +  dst[dst_size - 1] = 0;
  
 -  return ((int) vb->val_len);
 +  if (dst_size <= vb->val_len)
 +    return ENOMEM;
 +
 +  return 0;
  } /* }}} int csnmp_strvbcopy */
  
  static int csnmp_instance_list_add (csnmp_list_instances_t **head,
@@@ -1235,7 -1224,7 +1235,7 @@@ static int csnmp_dispatch_table (host_d
    csnmp_list_instances_t *instance_list_ptr;
    csnmp_table_values_t **value_table_ptr;
  
 -  int i;
 +  size_t i;
    _Bool have_more;
    oid_t current_suffix;
  
  
    instance_list_ptr = instance_list;
  
 -  value_table_ptr = calloc ((size_t) data->values_len, sizeof (*value_table_ptr));
 +  value_table_ptr = calloc (data->values_len, sizeof (*value_table_ptr));
    if (value_table_ptr == NULL)
      return (-1);
    for (i = 0; i < data->values_len; i++)
@@@ -1393,7 -1382,7 +1393,7 @@@ static int csnmp_read_table (host_defin
  
    const data_set_t *ds;
  
 -  uint32_t oid_list_len = (uint32_t) (data->values_len + 1);
 +  size_t oid_list_len = data->values_len + 1;
    /* Holds the last OID returned by the device. We use this in the GETNEXT
     * request to proceed. */
    oid_t oid_list[oid_list_len];
    _Bool oid_list_todo[oid_list_len];
  
    int status;
 -  int i;
 -  uint32_t j;
 +  size_t i;
  
    /* `value_list_head' and `value_list_tail' implement a linked list for each
     * value. `instance_list_head' and `instance_list_tail' implement a linked list of
  
    if (ds->ds_num != data->values_len)
    {
 -    ERROR ("snmp plugin: DataSet `%s' requires %i values, but config talks about %i",
 +    ERROR ("snmp plugin: DataSet `%s' requires %zu values, but config talks about %zu",
          data->type, ds->ds_num, data->values_len);
      return (-1);
    }
    else /* no InstanceFrom option specified. */
      oid_list_len--;
  
 -  for (j = 0; j < oid_list_len; j++)
 -    oid_list_todo[j] = 1;
 +  for (i = 0; i < oid_list_len; i++)
 +    oid_list_todo[i] = 1;
  
    /* We're going to construct n linked lists, one for each "value".
     * value_list_head will contain pointers to the heads of these linked lists,
      }
  
      oid_list_todo_num = 0;
 -    for (j = 0; j < oid_list_len; j++)
 +    for (i = 0; i < oid_list_len; i++)
      {
        /* Do not rerequest already finished OIDs */
 -      if (!oid_list_todo[j])
 +      if (!oid_list_todo[i])
          continue;
        oid_list_todo_num++;
 -      snmp_add_null_var (req, oid_list[j].oid, oid_list[j].oid_len);
 +      snmp_add_null_var (req, oid_list[i].oid, oid_list[i].oid_len);
      }
  
      if (oid_list_todo_num == 0)
          ret = csnmp_oid_suffix (&suffix, &vb_name, data->values + i);
          if (ret != 0)
          {
 -          DEBUG ("snmp plugin: host = %s; data = %s; i = %i; "
 +          DEBUG ("snmp plugin: host = %s; data = %s; i = %zu; "
                "Value probably left its subtree.",
                host->name, data->name, i);
            oid_list_todo[i] = 0;
          if ((value_list_tail[i] != NULL)
              && (csnmp_oid_compare (&suffix, &value_list_tail[i]->suffix) <= 0))
          {
 -          DEBUG ("snmp plugin: host = %s; data = %s; i = %i; "
 +          DEBUG ("snmp plugin: host = %s; data = %s; i = %zu; "
                "Suffix is not increasing.",
                host->name, data->name, i);
            oid_list_todo[i] = 0;
@@@ -1674,14 -1664,14 +1674,14 @@@ static int csnmp_read_value (host_defin
    value_list_t vl = VALUE_LIST_INIT;
  
    int status;
 -  int i;
 +  size_t i;
  
    DEBUG ("snmp plugin: csnmp_read_value (host = %s, data = %s)",
        host->name, data->name);
  
    if (host->sess_handle == NULL)
    {
-     DEBUG ("snmp plugin: csnmp_read_table: host->sess_handle == NULL");
+     DEBUG ("snmp plugin: csnmp_read_value: host->sess_handle == NULL");
      return (-1);
    }
  
  
    if (ds->ds_num != data->values_len)
    {
 -    ERROR ("snmp plugin: DataSet `%s' requires %i values, but config talks about %i",
 +    ERROR ("snmp plugin: DataSet `%s' requires %zu values, but config talks about %zu",
          data->type, ds->ds_num, data->values_len);
      return (-1);
    }