Code

Merge branch 'collectd-5.0' into collectd-5.1
authorFlorian Forster <octo@collectd.org>
Fri, 7 Sep 2012 09:15:24 +0000 (11:15 +0200)
committerFlorian Forster <octo@collectd.org>
Fri, 7 Sep 2012 09:15:24 +0000 (11:15 +0200)
Conflicts:
src/swap.c

1  2 
configure.in
contrib/collection3/bin/index.cgi
src/Makefile.am
src/collectd.conf.pod
src/snmp.c
src/utils_avltree.c

diff --combined configure.in
index 1cfc2fcae20b4f2be5a2064c0c1174ab096a5bb2,b5c3e29d658598e567229d76616ea3e6209150ee..a63544a6f021c03e57cb5508790c23d5cc4a0835
@@@ -1,5 -1,5 +1,5 @@@
  dnl Process this file with autoconf to produce a configure script.
 -AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
 +AC_INIT(collectd, [m4_esyscmd(./version-gen.sh)])
  AC_CONFIG_SRCDIR(src/collectd.c)
  AC_CONFIG_HEADERS(src/config.h)
  AC_CONFIG_AUX_DIR([libltdl/config])
@@@ -91,6 -91,7 +91,7 @@@ f
  if test "x$ac_system" = "xSolaris"
  then
        AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
+       AC_DEFINE(_REENTRANT,               1, [Define to enable reentrancy interfaces.])
  fi
  if test "x$ac_system" = "xAIX"
  then
  # For hddtemp module
  AC_CHECK_HEADERS(linux/major.h libgen.h)
  
 +# For md module (Linux only)
 +if test "x$ac_system" = "xLinux"
 +then
 +      AC_CHECK_HEADERS(linux/raid/md_u.h,
 +                       [have_linux_raid_md_u_h="yes"],
 +                       [have_linux_raid_md_u_h="no"],
 +[
 +#include <sys/ioctl.h>
 +#include <linux/major.h>
 +#include <linux/types.h>
 +])
 +else
 +      have_linux_raid_md_u_h="no"
 +fi
 +
  # For the battery plugin
  AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
  [
@@@ -403,33 -389,6 +404,33 @@@ AC_CHECK_HEADERS(linux/netdevice.h, []
  #endif
  ])
  
 +# For ethstat module
 +AC_CHECK_HEADERS(linux/sockios.h,
 +    [have_linux_sockios_h="yes"],
 +    [have_linux_sockios_h="no"],
 +    [
 +#if HAVE_SYS_IOCTL_H
 +# include <sys/ioctl.h>
 +#endif
 +#if HAVE_NET_IF_H
 +# include <net/if.h>
 +#endif
 +    ])
 +AC_CHECK_HEADERS(linux/ethtool.h,
 +    [have_linux_ethtool_h="yes"],
 +    [have_linux_ethtool_h="no"],
 +    [
 +#if HAVE_SYS_IOCTL_H
 +# include <sys/ioctl.h>
 +#endif
 +#if HAVE_NET_IF_H
 +# include <net/if.h>
 +#endif
 +#if HAVE_LINUX_SOCKIOS_H
 +# include <linux/sockios.h>
 +#endif
 +    ])
 +
  # For ipvs module
  have_linux_ip_vs_h="no"
  have_net_ip_vs_h="no"
@@@ -532,6 -491,8 +533,8 @@@ AC_CHECK_HEADERS(netinet/if_ether.h, []
  #endif
  ])
  
+ AC_CHECK_HEADERS(netinet/ip_compat.h)
  # For the multimeter plugin
  have_termios_h="no"
  AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
@@@ -1301,7 -1262,6 +1304,7 @@@ AC_CHECK_MEMBERS([kstat_io_t.nwritten, 
  #
  # Checks for libraries begin here
  #
 +
  with_libresolv="yes"
  AC_CHECK_LIB(resolv, res_search,
  [
  fi
  if test "x$with_libmodbus" = "xuse_pkgconfig"
  then
 -      AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
 -      $PKG_CONFIG --exists 'modbus' 2>/dev/null
 +      AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
 +      $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
        if test $? -ne 0
        then
 -              with_libmodbus="no (pkg-config doesn't know modbus)"
 +              with_libmodbus="no (pkg-config doesn't know libmodbus)"
        fi
  fi
  if test "x$with_libmodbus" = "xuse_pkgconfig"
  then
 -      with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
 +      with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
        if test $? -ne 0
        then
                with_libmodbus="no ($PKG_CONFIG failed)"
        fi
 -      with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
 +      with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
        if test $? -ne 0
        then
                with_libmodbus="no ($PKG_CONFIG failed)"
  fi
  # }}}
  
 +# --with-libmongoc {{{
 +AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
 +[
 + if test "x$withval" = "xyes"
 + then
 +       with_libmongoc="yes"
 + else if test "x$withval" = "xno"
 + then
 +       with_libmongoc="no"
 + else
 +       with_libmongoc="yes"
 +       LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
 +       LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
 + fi; fi
 +],
 +[with_libmongoc="yes"])
 +
 +SAVE_CPPFLAGS="$CPPFLAGS"
 +SAVE_LDFLAGS="$LDFLAGS"
 +
 +CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
 +LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
 +
 +if test "x$with_libmongoc" = "xyes"
 +then
 +      if test "x$LIBMONGOC_CPPFLAGS" != "x"
 +      then
 +              AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
 +      fi
 +      AC_CHECK_HEADERS(mongo.h,
 +      [with_libmongoc="yes"],
 +      [with_libmongoc="no ('mongo.h' not found)"],
 +[#if HAVE_STDINT_H
 +# define MONGO_HAVE_STDINT 1
 +#else
 +# define MONGO_USE_LONG_LONG_INT 1
 +#endif
 +])
 +fi
 +if test "x$with_libmongoc" = "xyes"
 +then
 +      if test "x$LIBMONGOC_LDFLAGS" != "x"
 +      then
 +              AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
 +      fi
 +      AC_CHECK_LIB(mongoc, mongo_run_command,
 +      [with_libmongoc="yes"],
 +      [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
 +fi
 +
 +CPPFLAGS="$SAVE_CPPFLAGS"
 +LDFLAGS="$SAVE_LDFLAGS"
 +
 +if test "x$with_libmongoc" = "xyes"
 +then
 +      BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
 +      BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
 +      AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
 +      AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
 +fi
 +AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
 +# }}}
 +
  # --with-libmysql {{{
  with_mysql_config="mysql_config"
  with_mysql_cflags=""
@@@ -4116,9 -4013,10 +4119,9 @@@ the
        CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
        #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
  
 -      AC_CHECK_LIB(varnishapi, VSL_OpenStats,
 -                   [with_libvarnish="yes"],
 -                   [with_libvarnish="no (symbol VSL_OpenStats not found)"],
 -                   [$with_libvarnish_libs])
 +    AC_CHECK_HEADERS(varnish/vsc.h,
 +        [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
 +        [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
  
        CPPFLAGS="$SAVE_CPPFLAGS"
        #LDFLAGS="$SAVE_LDFLAGS"
@@@ -4476,8 -4374,6 +4479,8 @@@ plugin_curl_xml="no
  plugin_df="no"
  plugin_disk="no"
  plugin_entropy="no"
 +plugin_ethstat="no"
 +plugin_fscache="no"
  plugin_interface="no"
  plugin_ipmi="no"
  plugin_ipvs="no"
@@@ -4487,7 -4383,7 +4490,7 @@@ plugin_load="no
  plugin_memory="no"
  plugin_multimeter="no"
  plugin_nfs="no"
 -plugin_fscache="no"
 +plugin_numa="no"
  plugin_perl="no"
  plugin_processes="no"
  plugin_protocols="no"
        plugin_cpufreq="yes"
        plugin_disk="yes"
        plugin_entropy="yes"
 +      plugin_fscache="yes"
        plugin_interface="yes"
        plugin_irq="yes"
        plugin_load="yes"
        plugin_memory="yes"
        plugin_nfs="yes"
 -      plugin_fscache="yes"
 +      plugin_numa="yes"
        plugin_processes="yes"
        plugin_protocols="yes"
        plugin_serial="yes"
  fi
  
  # AIX
 +
 +if test "x$ac_system" = "xAIX"
 +then
 +        plugin_tcpconns="yes"
 +fi
 +
  if test "x$with_perfstat" = "xyes"
  then
        plugin_cpu="yes"
  # Solaris
  if test "x$with_kstat" = "xyes"
  then
 +      plugin_nfs="yes"
        plugin_uptime="yes"
        plugin_zfs_arc="yes"
  fi
        fi
  fi
  
 +if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
 +then
 +      plugin_ethstat="yes"
 +fi
 +
  if test "x$have_getifaddrs" = "xyes"
  then
        plugin_interface="yes"
@@@ -4795,7 -4678,6 +4798,7 @@@ AC_PLUGIN([disk],        [$plugin_disk]
  AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
  AC_PLUGIN([email],       [yes],                [EMail statistics])
  AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
 +AC_PLUGIN([ethstat],     [$plugin_ethstat],    [Stats from NIC driver])
  AC_PLUGIN([exec],        [yes],                [Execution of external programs])
  AC_PLUGIN([filecount],   [yes],                [Count files in directories])
  AC_PLUGIN([fscache],     [$plugin_fscache],    [fscache statistics])
@@@ -4818,7 -4700,6 +4821,7 @@@ AC_PLUGIN([match_regex], [yes]
  AC_PLUGIN([match_timediff], [yes],             [The timediff match])
  AC_PLUGIN([match_value], [yes],                [The value match])
  AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
 +AC_PLUGIN([md],          [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
  AC_PLUGIN([memcachec],   [$with_libmemcached], [memcachec statistics])
  AC_PLUGIN([memcached],   [yes],                [memcached statistics])
  AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
@@@ -4833,7 -4714,6 +4836,7 @@@ AC_PLUGIN([nginx],       [$with_libcurl
  AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
  AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
  AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
 +AC_PLUGIN([numa],        [$plugin_numa],       [NUMA virtual memory statistics])
  AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
  AC_PLUGIN([olsrd],       [yes],                [olsrd statistics])
  AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
@@@ -4879,10 -4759,8 +4882,10 @@@ AC_PLUGIN([varnish],     [$with_libvarn
  AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
  AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
  AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
 +AC_PLUGIN([write_graphite], [yes],             [Graphite / Carbon output plugin])
  AC_PLUGIN([write_http],  [$with_libcurl],      [HTTP output plugin])
  AC_PLUGIN([write_redis], [$with_libcredis],    [Redis output plugin])
 +AC_PLUGIN([write_mongodb], [$with_libmongoc],  [MongoDB output plugin])
  AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
  AC_PLUGIN([zfs_arc],     [$plugin_zfs_arc],    [ZFS ARC statistics])
  
@@@ -5025,7 -4903,7 +5028,7 @@@ AC_SUBST(LCC_VERSION_STRING
  
  AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
  
 -AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
 +AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
  
  if test "x$with_librrd" = "xyes" \
        && test "x$librrd_threadsafe" != "xyes"
@@@ -5127,7 -5005,6 +5130,7 @@@ Configuration
      dns . . . . . . . . . $enable_dns
      email . . . . . . . . $enable_email
      entropy . . . . . . . $enable_entropy
 +    ethstat . . . . . . . $enable_ethstat
      exec  . . . . . . . . $enable_exec
      filecount . . . . . . $enable_filecount
      fscache . . . . . . . $enable_fscache
      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
      notify_desktop  . . . $enable_notify_desktop
      notify_email  . . . . $enable_notify_email
      ntpd  . . . . . . . . $enable_ntpd
 +    numa  . . . . . . . . $enable_numa
      nut . . . . . . . . . $enable_nut
      olsrd . . . . . . . . $enable_olsrd
      onewire . . . . . . . $enable_onewire
      vmem  . . . . . . . . $enable_vmem
      vserver . . . . . . . $enable_vserver
      wireless  . . . . . . $enable_wireless
 +    write_graphite  . . . $enable_write_graphite
      write_http  . . . . . $enable_write_http
      write_redis . . . . . $enable_write_redis
 +    write_mongodb . . . . $enable_write_mongodb
      xmms  . . . . . . . . $enable_xmms
      zfs_arc . . . . . . . $enable_zfs_arc
  
index 4723af964e9ecf7f6ae5a965b00855748a8adcfc,e28e98572238e04e6e1e9ea52a6a8d565e88b1e2..a85027176c426dfd0f4e59c8fb109953d7237d42
@@@ -1,7 -1,6 +1,7 @@@
  #!/usr/bin/perl
  
 -# Copyright (C) 2008  Florian octo Forster <octo at verplant.org>
 +# Copyright (C) 2008-2011  Florian Forster
 +# Copyright (C) 2011       noris network AG
  #
  # This program is free software; you can redistribute it and/or modify it under
  # the terms of the GNU General Public License as published by the Free Software
  # You should have received a copy of the GNU General Public License along with
  # this program; if not, write to the Free Software Foundation, Inc.,
  # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 +#
 +# Authors:
 +#   Florian "octo" Forster <octo at collectd.org>
  
  use strict;
  use warnings;
 -use lib ('../lib');
  use utf8;
 +use vars (qw($BASE_DIR));
 +
 +BEGIN
 +{
 +  if (defined $ENV{'SCRIPT_FILENAME'})
 +  {
 +    if ($ENV{'SCRIPT_FILENAME'} =~ m{^(/.+)/bin/[^/]+$})
 +    {
 +      $::BASE_DIR = $1;
 +      unshift (@::INC, "$::BASE_DIR/lib");
 +    }
 +  }
 +}
  
  use Carp (qw(cluck confess));
 -use FindBin ('$RealBin');
  use CGI (':cgi');
  use CGI::Carp ('fatalsToBrowser');
  use HTML::Entities ('encode_entities');
@@@ -50,6 -35,8 +50,6 @@@ use Collectd::Graph::Common (qw(get_fil
        get_plugin_selection flush_files));
  use Collectd::Graph::Type ();
  
 -our $Debug = param ('debug') ? 1 : 0;
 -
  our $TimeSpans =
  {
    Hour  =>        3600,
    Year  => 366 * 86400
  };
  
 -my $action = param ('action') || 'list_hosts';
 -our %Actions =
 +my %Actions =
  (
    list_hosts => \&action_list_hosts,
    show_selection => \&action_show_selection
  );
  
 -if (!exists ($Actions{$action}))
 +sub base_dir
 +{
 +  if (defined $::BASE_DIR)
 +  {
 +    return ($::BASE_DIR);
 +  }
 +
 +  if (!defined ($ENV{'SCRIPT_FILENAME'}))
 +  {
 +    return;
 +  }
 +
 +  if ($ENV{'SCRIPT_FILENAME'} =~ m{^(/.+)/bin/[^/]+$})
 +  {
 +    $::BASE_DIR = $1;
 +    return ($::BASE_DIR);
 +  }
 +
 +  return;
 +}
 +
 +sub lib_dir
  {
 -  print STDERR "No such action: $action\n";
 -  exit 1;
 +  my $base = base_dir ();
 +
 +  if ($base)
 +  {
 +    return "$base/lib";
 +  }
 +  else
 +  {
 +    return "../lib";
 +  }
  }
  
 -gc_read_config ("$RealBin/../etc/collection.conf");
 +sub sysconf_dir
 +{
 +  my $base = base_dir ();
  
 -$Actions{$action}->();
 -exit (0);
 +  if ($base)
 +  {
 +    return "$base/etc";
 +  }
 +  else
 +  {
 +    return "../etc";
 +  }
 +}
 +
 +sub init
 +{
 +  my $lib_dir = lib_dir ();
 +  my $sysconf_dir = sysconf_dir ();
 +
 +  if (!grep { $lib_dir eq $_ } (@::INC))
 +  {
 +    unshift (@::INC, $lib_dir);
 +  }
 +
 +  gc_read_config ("$sysconf_dir/collection.conf");
 +}
 +
 +sub main
 +{
 +  my $Debug = param ('debug') ? 1 : 0;
 +  my $action = param ('action') || 'list_hosts';
 +
 +  if (!exists ($Actions{$action}))
 +  {
 +    print STDERR "No such action: $action\n";
 +    return (1);
 +  }
 +
 +  init ();
 +
 +  $Actions{$action}->();
 +  return (1);
 +} # sub main
  
  sub can_handle_xhtml
  {
    }
  } # can_handle_xhtml
  
 -{my $html_started;
 +my $html_started;
  sub start_html
  {
    return if ($html_started);
  
    if (can_handle_xhtml ())
    {
 +    print header (-Content_Type => 'application/xhtml+xml; charset=UTF-8');
      print <<HTML;
 -Content-Type: application/xhtml+xml; charset=UTF-8
 -
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@@@ -212,8 -133,9 +212,8 @@@ HTM
    }
    else
    {
 +    print header (-Content_Type => 'text/html; charset=UTF-8');
      print <<HTML;
 -Content-Type: text/html; charset=UTF-8
 -
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd">
  <html>
@@@ -229,7 -151,7 +229,7 @@@ HTM
    <body onload="nav_init ($begin, $end);">
  HTML
    $html_started = 1;
 -}}
 +}
  
  sub end_html
  {
    </body>
  </html>
  HTML
 +  $html_started = 0;
 +}
 +
 +sub contains_invalid_chars
 +{
 +  my $str = shift;
 +
 +  for (split (m//, $str))
 +  {
 +    my $n = ord ($_);
 +
 +    # Whitespace is allowed.
 +    if (($n >= 9) && ($n <= 13))
 +    {
 +      next;
 +    }
 +    elsif ($n < 32)
 +    {
 +      return (1);
 +    }
 +  }
 +
 +  return;
  }
  
+ sub contains_invalid_chars
+ {
+   my $str = shift;
+   for (split (m//, $str))
+   {
+     my $n = ord ($_);
+     # Whitespace is allowed.
+     if (($n >= 9) && ($n <= 13))
+     {
+       next;
+     }
+     elsif ($n < 32)
+     {
+       return (1);
+     }
+   }
+   return;
+ }
  sub show_selector
  {
    my $timespan_selection = get_timespan_selection ();
@@@ -387,7 -308,7 +409,7 @@@ sub action_show_selectio
    $all_files = get_selected_files ();
    $timespan = get_timespan_selection ();
  
 -  if ($Debug)
 +  if (param ('debug'))
    {
      print "<pre>", Data::Dumper->Dump ([$all_files], ['all_files']), "</pre>\n";
    }
        $types->{$type} = tl_load_type ($file->{'type'});
        if (!$types->{$type})
        {
 -        cluck ("tl_load_type (" . $file->{'type'} . ") failed");
 +        warn ("tl_load_type (" . $file->{'type'} . ") failed");
          next;
        }
      }
    for (sort (keys %$types))
    {
      my $type = $_;
 +
 +    if (!defined ($types->{$type}))
 +    {
 +      next;
 +    }
 +
      my $graphs_num = $types->{$type}->getGraphsNum ();
  
      for (my $i = 0; $i < $graphs_num; $i++)
@@@ -485,8 -400,6 +507,8 @@@ EO
    end_html ();
  }
  
 +main ();
 +
  =head1 SEE ALSO
  
  L<Collectd::Graph::Type>
diff --combined src/Makefile.am
index f106fa1a85641c7a02e95b1d3f34eb7a2947a789,72a2e389e6a32f892db5a0dfa577bbdfbbc82a3c..8fa033013e96d54110c78d6eb764194f125ec970
@@@ -1,4 -1,7 +1,4 @@@
  SUBDIRS = libcollectdclient
 -if BUILD_WITH_OWN_LIBIPTC
 -SUBDIRS += owniptc
 -endif
  if BUILD_WITH_OWN_LIBOCONFIG
  SUBDIRS += liboconfig
  endif
@@@ -43,7 -46,7 +43,7 @@@ collectd_SOURCES = collectd.c collectd.
  collectd_CPPFLAGS =  $(AM_CPPFLAGS) $(LTDLINCL)
  collectd_CFLAGS = $(AM_CFLAGS)
  collectd_LDFLAGS = -export-dynamic
- collectd_LDADD =
+ collectd_LDADD = -lm
  collectd_DEPENDENCIES =
  
  # Link to these libraries..
@@@ -70,7 -73,6 +70,6 @@@ collectd_LDADD += -ldevinf
  endif
  if BUILD_AIX
  collectd_LDFLAGS += -Wl,-bexpall,-brtllib
- collectd_LDADD += -lm
  endif
  
  # The daemon needs to call sg_init, so we need to link it against libstatgrab,
@@@ -378,14 -380,6 +377,14 @@@ collectd_LDADD += "-dlopen" exec.l
  collectd_DEPENDENCIES += exec.la
  endif
  
 +if BUILD_PLUGIN_ETHSTAT
 +pkglib_LTLIBRARIES += ethstat.la
 +ethstat_la_SOURCES = ethstat.c
 +ethstat_la_LDFLAGS = -module -avoid-version
 +collectd_LDADD += "-dlopen" ethstat.la
 +collectd_DEPENDENCIES += ethstat.la
 +endif
 +
  if BUILD_PLUGIN_FILECOUNT
  pkglib_LTLIBRARIES += filecount.la
  filecount_la_SOURCES = filecount.c
@@@ -445,7 -439,12 +444,7 @@@ pkglib_LTLIBRARIES += iptables.l
  iptables_la_SOURCES = iptables.c
  iptables_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBIPTC_CPPFLAGS)
  iptables_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBIPTC_LDFLAGS)
 -if BUILD_WITH_OWN_LIBIPTC
 -iptables_la_LIBADD  = owniptc/libiptc.la
 -iptables_la_DEPENDENCIES = owniptc/libiptc.la
 -else
  iptables_la_LIBADD = -liptc
 -endif
  collectd_LDADD += "-dlopen" iptables.la
  collectd_DEPENDENCIES += iptables.la
  endif
@@@ -595,14 -594,6 +594,14 @@@ collectd_LDADD += "-dlopen" mbmon.l
  collectd_DEPENDENCIES += mbmon.la
  endif
  
 +if BUILD_PLUGIN_MD
 +pkglib_LTLIBRARIES += md.la
 +md_la_SOURCES = md.c
 +md_la_LDFLAGS = -module -avoid-version
 +collectd_LDADD += "-dlopen" md.la
 +collectd_DEPENDENCIES += md.la
 +endif
 +
  if BUILD_PLUGIN_MEMCACHEC
  pkglib_LTLIBRARIES += memcachec.la
  memcachec_la_SOURCES = memcachec.c
@@@ -780,14 -771,6 +779,14 @@@ collectd_LDADD += "-dlopen" ntpd.l
  collectd_DEPENDENCIES += ntpd.la
  endif
  
 +if BUILD_PLUGIN_NUMA
 +pkglib_LTLIBRARIES += numa.la
 +numa_la_SOURCES = numa.c
 +numa_la_LDFLAGS = -module -avoid-version
 +collectd_LDADD += "-dlopen" numa.la
 +collectd_DEPENDENCIES += numa.la
 +endif
 +
  if BUILD_PLUGIN_NUT
  pkglib_LTLIBRARIES += nut.la
  nut_la_SOURCES = nut.c
@@@ -1254,15 -1237,6 +1253,15 @@@ collectd_LDADD += "-dlopen" wireless.l
  collectd_DEPENDENCIES += wireless.la
  endif
  
 +if BUILD_PLUGIN_WRITE_GRAPHITE
 +pkglib_LTLIBRARIES += write_graphite.la
 +write_graphite_la_SOURCES = write_graphite.c \
 +                      utils_format_json.c utils_format_json.h
 +write_graphite_la_LDFLAGS = -module -avoid-version
 +collectd_LDADD += "-dlopen" write_graphite.la
 +collectd_DEPENDENCIES += write_graphite.la
 +endif
 +
  if BUILD_PLUGIN_WRITE_HTTP
  pkglib_LTLIBRARIES += write_http.la
  write_http_la_SOURCES = write_http.c \
@@@ -1278,16 -1252,6 +1277,16 @@@ endi
  collectd_DEPENDENCIES += write_http.la
  endif
  
 +if BUILD_PLUGIN_WRITE_MONGODB
 +pkglib_LTLIBRARIES += write_mongodb.la
 +write_mongodb_la_SOURCES = write_mongodb.c
 +write_mongodb_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBMONGOC_CPPFLAGS)
 +write_mongodb_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBMONGOC_LDFLAGS)
 +write_mongodb_la_LIBADD = -lmongoc
 +collectd_LDADD += "-dlopen" write_mongodb.la
 +collectd_DEPENDENCIES += write_mongodb.la
 +endif
 +
  if BUILD_PLUGIN_WRITE_REDIS
  pkglib_LTLIBRARIES += write_redis.la
  write_redis_la_SOURCES = write_redis.c
@@@ -1370,7 -1334,7 +1369,7 @@@ EXTRA_DIST +=   collectd.conf.pod 
        fi
  
  pinba.pb-c.c pinba.pb-c.h: pinba.proto
-       protoc-c --c_out $(builddir) pinba.proto
+       protoc-c --c_out . pinba.proto
  
  install-exec-hook:
        $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
diff --combined src/collectd.conf.pod
index 01d0dea0baa27bbb2e89ae088136571d78794c39,bee566cd1a991fa9c7f1fc51ec6834c4185a14db..c025f94928552961b2056e70029d2694a128343e
@@@ -25,22 -25,32 +25,32 @@@ controls which plugins to load. These p
  behavior.
  
  The syntax of this config file is similar to the config file of the famous
- B<Apache Webserver>. Each line contains either a key-value-pair or a
- section-start or -end. Empty lines and everything after the hash-symbol `#' is
- ignored. Values are either string, enclosed in double-quotes,
- (floating-point-)numbers or a boolean expression, i.E<nbsp>e. either B<true> or
- B<false>. String containing of only alphanumeric characters and underscores do
- not need to be quoted. Lines may be wrapped by using `\' as the last character
- before the newline. This allows long lines to be split into multiple lines.
- Quoted strings may be wrapped as well. However, those are treated special in
- that whitespace at the beginning of the following lines will be ignored, which
- allows for nicely indenting the wrapped lines.
- The configuration is read and processed in order, i.E<nbsp>e. from top to
- bottom. So the plugins are loaded in the order listed in this config file. It
- is a good idea to load any logging plugins first in order to catch messages
- from plugins during configuration. Also, the C<LoadPlugin> option B<must> occur
- B<before> the C<E<lt>Plugin ...E<gt>> block.
+ I<Apache> webserver. Each line contains either an option (a key and a list of
+ one or more values) or a section-start or -end. Empty lines and everything
+ after a non-quoted hash-symbol (C<#>) is ignored. I<Keys> are unquoted
+ strings, consisting only of alphanumeric characters and the underscore (C<_>)
+ character. Keys are handled case insensitive by I<collectd> itself and all
+ plugins included with it. I<Values> can either be an I<unquoted string>, a
+ I<quoted string> (enclosed in double-quotes) a I<number> or a I<boolean>
+ expression. I<Unquoted strings> consist of only alphanumeric characters and
+ underscores (C<_>) and do not need to be quoted. I<Quoted strings> are
+ enclosed in double quotes (C<">). You can use the backslash character (C<\>)
+ to include double quotes as part of the string. I<Numbers> can be specified in
+ decimal and floating point format (using a dot C<.> as decimal separator),
+ hexadecimal when using the C<0x> prefix and octal with a leading zero (C<0>).
+ I<Boolean> values are either B<true> or B<false>.
+ Lines may be wrapped by using C<\> as the last character before the newline.
+ This allows long lines to be split into multiple lines. Quoted strings may be
+ wrapped as well. However, those are treated special in that whitespace at the
+ beginning of the following lines will be ignored, which allows for nicely
+ indenting the wrapped lines.
+ The configuration is read and processed in order, i.e. from top to bottom. So
+ the plugins are loaded in the order listed in this config file. It is a good
+ idea to load any logging plugins first in order to catch messages from plugins
+ during configuration. Also, the C<LoadPlugin> option B<must> occur B<before>
+ the appropriate C<E<lt>Plugin ...E<gt>> block.
  
  =head1 GLOBAL OPTIONS
  
@@@ -483,7 -493,6 +493,7 @@@ Synopsis
  
   <Plugin "bind">
     URL "http://localhost:8053/"
 +   ParseTime       false
     OpCodes         true
     QTypes          true
   
@@@ -510,44 -519,35 +520,44 @@@ The bind plugin accepts the following c
  URL from which to retrieve the XML data. If not specified,
  C<http://localhost:8053/> will be used.
  
 -=item B<OpCodes> I<true>|I<false>
 +=item B<ParseTime> B<true>|B<false>
 +
 +When set to B<true>, the time provided by BIND will be parsed and used to
 +dispatch the values. When set to B<false>, the local time source is queried.
 +
 +This setting is set to B<true> by default for backwards compatibility; setting
 +this to B<false> is I<recommended> to avoid problems with timezones and
 +localization.
 +
 +=item B<OpCodes> B<true>|B<false>
  
  When enabled, statistics about the I<"OpCodes">, for example the number of
  C<QUERY> packets, are collected.
  
  Default: Enabled.
  
 -=item B<QTypes> I<true>|I<false>
 +=item B<QTypes> B<true>|B<false>
  
  When enabled, the number of I<incoming> queries by query types (for example
  C<A>, C<MX>, C<AAAA>) is collected.
  
  Default: Enabled.
  
 -=item B<ServerStats> I<true>|I<false>
 +=item B<ServerStats> B<true>|B<false>
  
  Collect global server statistics, such as requests received over IPv4 and IPv6,
  successful queries, and failed updates.
  
  Default: Enabled.
  
 -=item B<ZoneMaintStats> I<true>|I<false>
 +=item B<ZoneMaintStats> B<true>|B<false>
  
  Collect zone maintenance statistics, mostly information about notifications
  (zone updates) and zone transfers.
  
  Default: Enabled.
  
 -=item B<ResolverStats> I<true>|I<false>
 +=item B<ResolverStats> B<true>|B<false>
  
  Collect resolver statistics, i.E<nbsp>e. statistics about outgoing requests
  (e.E<nbsp>g. queries over IPv4, lame servers). Since the global resolver
@@@ -576,21 -576,21 +586,21 @@@ configured, no detailed view statistic
  
  =over 4
  
 -=item B<QTypes> I<true>|I<false>
 +=item B<QTypes> B<true>|B<false>
  
  If enabled, the number of I<outgoing> queries by query type (e.E<nbsp>g. C<A>,
  C<MX>) is collected.
  
  Default: Enabled.
  
 -=item B<ResolverStats> I<true>|I<false>
 +=item B<ResolverStats> B<true>|B<false>
  
  Collect resolver statistics, i.E<nbsp>e. statistics about outgoing requests
  (e.E<nbsp>g. queries over IPv4, lame servers).
  
  Default: Enabled.
  
 -=item B<CacheRRSets> I<true>|I<false>
 +=item B<CacheRRSets> B<true>|B<false>
  
  If enabled, the number of entries (I<"RR sets">) in the view's cache by query
  type is collected. Negative entries (queries which resulted in an error, for
@@@ -1272,41 -1272,6 +1282,41 @@@ at most B<16384> to prevent typos and d
  
  =back
  
 +=head2 Plugin C<ethstat>
 +
 +The I<ethstat plugin> collects information about network interface cards (NICs)
 +by talking directly with the underlying kernel driver using L<ioctl(2)>.
 +
 +B<Synopsis:>
 +
 + <Plugin "ethstat">
 +   Interface "eth0"
 +   Map "rx_csum_offload_errors" "if_rx_errors" "checksum_offload"
 +   Map "multicast" "if_multicast"
 + </Plugin>
 +
 +B<Options:>
 +
 +=over 4
 +
 +=item B<Interface> I<Name>
 +
 +Collect statistical information about interface I<Name>.
 +
 +=item B<Map> I<Name> I<Type> [I<TypeInstance>]
 +
 +By default, the plugin will submit values as type C<derive> and I<type
 +instance> set to I<Name>, the name of the metric as reported by the driver. If
 +an appropriate B<Map> option exists, the given I<Type> and, optionally,
 +I<TypeInstance> will be used.
 +
 +=item B<MappedOnly> B<true>|B<false>
 +
 +When set to B<true>, only metrics that can be mapped to to a I<type> will be
 +collected, all other metrics will be ignored. Defaults to B<false>.
 +
 +=back
 +
  =head2 Plugin C<exec>
  
  Please make sure to read L<collectd-exec(5)> before using this plugin. It
@@@ -1857,31 -1822,6 +1867,31 @@@ TCP-Port to connect to. Defaults to B<4
  
  =back
  
 +=head2 Plugin C<md>
 +
 +The C<md plugin> collects information from Linux Software-RAID devices (md).
 +
 +All reported values are of the type C<md_disks>. Reported type instances are
 +I<active>, I<failed> (present but not operational), I<spare> (hot stand-by) and
 +I<missing> (physically absent) disks.
 +
 +=over 4
 +
 +=item B<Device> I<Device>
 +
 +Select md devices based on device name. The I<device name> is the basename of
 +the device, i.e. the name of the block device without the leading C</dev/>.
 +See B<IgnoreSelected> for more details.
 +
 +=item B<IgnoreSelected> B<true>|B<false>
 +
 +Invert device selection: If set to B<true>, all md devices B<except> those
 +listed using B<Device> are collected. If B<false> (the default), only those
 +listed are collected. If no configuration is given, the B<md> plugin will
 +collect data from all md devices.
 +
 +=back
 +
  =head2 Plugin C<memcachec>
  
  The C<memcachec plugin> connects to a memcached server, queries one or more
@@@ -2003,11 -1943,11 +2013,11 @@@ Configures the base register to read fr
  B<RegisterType> has been set to B<Uint32> or B<Float>, this and the next
  register will be read (the register number is increased by one).
  
 -=item B<RegisterType> B<Uint16>|B<Uint32>|B<Float>
 +=item B<RegisterType> B<Int16>|B<Int32>|B<Uint16>|B<Uint32>|B<Float>
  
 -Specifies what kind of data is returned by the device. If the type is B<Uint32>
 -or B<Float>, two 16E<nbsp>bit registers will be read and the data is combined
 -into one value. Defaults to B<Uint16>.
 +Specifies what kind of data is returned by the device. If the type is B<Int32>,
 +B<Uint32> or B<Float>, two 16E<nbsp>bit registers will be read and the data is
 +combined into one value. Defaults to B<Uint16>.
  
  =item B<Type> I<Type>
  
@@@ -4238,11 -4178,6 +4248,11 @@@ L<http://secure.netroedge.com/~lm78/>
  
  =over 4
  
 +=item B<SensorConfigFile> I<File>
 +
 +Read the I<lm_sensors> configuration from I<File>. When unset (recommended),
 +the library's default will be used.
 +
  =item B<Sensor> I<chip-bus-address/type-feature>
  
  Selects the name of the sensor which you want to collect or ignore, depending
@@@ -4271,19 -4206,19 +4281,19 @@@ L<collectd-snmp(5)>. Please see there f
  =head2 Plugin C<swap>
  
  The I<Swap plugin> collects information about used and available swap space. On
 -I<Solaris>, the following options are available:
 +I<Linux> and I<Solaris>, the following options are available:
  
  =over 4
  
  =item B<ReportByDevice> B<false>|B<true>
  
 -Configures how to report physical swap devices. If set to B<false> is used (the
 +Configures how to report physical swap devices. If set to B<false> (the
  default), the summary over all swap devices is reported only, i.e. the globally
  used and available space over all devices. If B<true> is configured, the used
  and available space of each device will be reported separately.
  
 -This option is only available if the I<Swap plugin> can use the L<swapctl(2)>
 -mechanism under I<Solaris>.
 +This option is only available if the I<Swap plugin> can read C</proc/swaps>
 +(under Linux) or use the L<swapctl(2)> mechanism (under I<Solaris>).
  
  =back
  
@@@ -4300,15 -4235,6 +4310,15 @@@ syslog-daemon
  Please note that B<debug> is only available if collectd has been compiled with
  debugging support.
  
 +=item B<NotifyLevel> B<OKAY>|B<WARNING>|B<FAILURE>
 +
 +Controls which notifications should be sent to syslog. The default behaviour is
 +not to send any. Less severe notifications always imply logging more severe
 +notifications: Setting this to B<OKAY> means all notifications will be sent to
 +syslog, setting this to B<WARNING> will send B<WARNING> and B<FAILURE>
 +notifications but will dismiss B<OKAY> notifications. Setting this option to
 +B<FAILURE> will only send failures to syslog.
 +
  =back
  
  =head2 Plugin C<table>
@@@ -4859,115 -4785,6 +4869,115 @@@ traffic (e.E<nbsp>g. due to headers an
  collect on-wire traffic you could, for example, use the logging facilities of
  iptables to feed data for the guest IPs into the iptables plugin.
  
 +=head2 Plugin C<write_graphite>
 +
 +The C<write_graphite> plugin writes data to I<Graphite>, an open-source metrics
 +storage and graphing project. The plugin connects to I<Carbon>, the data layer
 +of I<Graphite>, and sends data via the "line based" protocol (per default using
 +portE<nbsp>2003). The data will be sent in blocks of at most 1428 bytes to
 +minimize the number of network packets.
 +
 +Synopsis:
 +
 + <Plugin write_graphite>
 +   <Carbon>
 +     Host "localhost"
 +     Port "2003"
 +     Prefix "collectd"
 +   </Carbon>
 + </Plugin>
 +
 +=over 4
 +
 +=item B<Host> I<Address>
 +
 +Hostname or address to connect to. Defaults to C<localhost>.
 +
 +=item B<Port> I<Service>
 +
 +Service name or port number to connect to. Defaults to C<2003>.
 +
 +=item B<Prefix> I<String>
 +
 +When set, I<String> is added in front of the host name. Dots and whitespace are
 +I<not> escaped in this string (see B<EscapeCharacter> below).
 +
 +=item B<Postfix> I<String>
 +
 +When set, I<String> is appended to the host name. Dots and whitespace are
 +I<not> escaped in this string (see B<EscapeCharacter> below).
 +
 +=item B<EscapeCharacter> I<Char>
 +
 +I<Carbon> uses the dot (C<.>) as escape character and doesn't allow whitespace
 +in the identifier. The B<EscapeCharacter> option determines which character
 +dots, whitespace and control characters are replaced with. Defaults to
 +underscore (C<_>).
 +
 +=item B<StoreRates> B<false>|B<true>
 +
 +If set to B<true> (the default), convert counter values to rates. If set to
 +B<false> counter values are stored as is, i.E<nbsp>e. as an increasing integer
 +number.
 +
 +=item B<SeparateInstances> B<false>|B<true>
 +
 +If set to B<true>, the plugin instance and type instance will be in their own
 +path component, for example C<host.cpu.0.cpu.idle>. If set to B<false> (the
 +default), the plugin and plugin instance (and likewise the type and type
 +instance) are put into one component, for example C<host.cpu-0.cpu-idle>.
 +
 +=item B<AlwaysAppendDS> B<false>|B<true>
 +
 +If set the B<true>, append the name of the I<Data Source> (DS) to the "metric"
 +identifier. If set to B<false> (the default), this is only done when there is
 +more than one DS.
 +
 +=back
 +
 +=head2 Plugin C<write_mongodb>
 +
 +The I<write_mongodb plugin> will send values to I<MongoDB>, a schema-less
 +NoSQL database.
 +
 +B<Synopsis:>
 +
 + <Plugin "write_mongodb">
 +   <Node "default">
 +     Host "localhost"
 +     Port "27017"
 +     Timeout 1000
 +     StoreRates true
 +   </Node>
 + </Plugin>
 +
 +The plugin can send values to multiple instances of I<MongoDB> by specifying
 +one B<Node> block for each instance. Within the B<Node> blocks, the following
 +options are available:
 +
 +=over 4
 +
 +=item B<Host> I<Address>
 +
 +Hostname or address to connect to. Defaults to C<localhost>.
 +
 +=item B<Port> I<Service>
 +
 +Service name or port number to connect to. Defaults to C<27017>.
 +
 +=item B<Timeout> I<Timeout>
 +
 +Set the timeout for each operation on I<MongoDB> to I<Timeout> milliseconds.
 +Setting this option to zero means no timeout, which is the default.
 +
 +=item B<StoreRates> B<false>|B<true>
 +
 +If set to B<true> (the default), convert counter values to rates. If set to
 +B<false> counter values are stored as is, i.e. as an increasing integer
 +number.
 +
 +=back
 +
  =head2 Plugin C<write_http>
  
  This output plugin submits values to an http server by POST them using the
@@@ -5821,7 -5638,7 +5831,7 @@@ convert counter values to rates
  
  Please note that these placeholders are B<case sensitive>!
  
 -=item B<Severity> B<"FATAL">|B<"WARNING">|B<"OKAY">
 +=item B<Severity> B<"FAILURE">|B<"WARNING">|B<"OKAY">
  
  Sets the severity of the message. If omitted, the severity B<"WARNING"> is
  used.
diff --combined src/snmp.c
index 160687f0ab56aad17116f5a198155f3f03e3652b,6ef3b94844d5ba6ccf8a859d62723990d2b82595..b68baf378f088d38ea69eecdde50a83a0bdd1854
@@@ -301,7 -301,7 +301,7 @@@ static int csnmp_config_add_data_shift 
    if ((ci->values_num != 1)
        || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
    {
-     WARNING ("snmp plugin: The `Scale' config option needs exactly one number argument.");
+     WARNING ("snmp plugin: The `Shift' config option needs exactly one number argument.");
      return (-1);
    }
  
@@@ -703,8 -703,7 +703,8 @@@ static void csnmp_host_open_session (ho
  
  /* TODO: Check if negative values wrap around. Problem: negative temperatures. */
  static value_t csnmp_value_list_to_value (struct variable_list *vl, int type,
 -    double scale, double shift)
 +    double scale, double shift,
 +    const char *host_name, const char *data_name)
  {
    value_t ret;
    uint64_t tmp_unsigned = 0;
          oid_buffer);
      else
  #endif
 -      WARNING ("snmp plugin: I don't know the ASN type \"%i\" (OID: %s)",
 -        (int) vl->type, oid_buffer);
 +      WARNING ("snmp plugin: I don't know the ASN type #%i "
 +               "(OID: \"%s\", data block \"%s\", host block \"%s\")",
 +          (int) vl->type, oid_buffer,
 +          (data_name != NULL) ? data_name : "UNKNOWN",
 +          (host_name != NULL) ? host_name : "UNKNOWN");
  
      defined = 0;
    }
@@@ -871,10 -867,12 +871,12 @@@ static int csnmp_check_res_left_subtre
        vb = vb->next_variable, i++)
    {
      num_checked++;
-     if (snmp_oid_ncompare (data->values[i].oid,
-         data->values[i].oid_len,
-         vb->name, vb->name_length,
-         data->values[i].oid_len) != 0)
+     if ((vb->type == SNMP_ENDOFMIBVIEW)
+       || (snmp_oid_ncompare (data->values[i].oid,
+           data->values[i].oid_len,
+           vb->name, vb->name_length,
+           data->values[i].oid_len) != 0))
        num_left_subtree++;
    }
  
@@@ -979,8 -977,7 +981,8 @@@ static int csnmp_strvbcopy (char *dst, 
  
  static int csnmp_instance_list_add (csnmp_list_instances_t **head,
      csnmp_list_instances_t **tail,
 -    const struct snmp_pdu *res)
 +    const struct snmp_pdu *res,
 +    const host_definition_t *hd, const data_definition_t *dd)
  {
    csnmp_list_instances_t *il;
    struct variable_list *vb;
    }
    else
    {
 -    value_t val = csnmp_value_list_to_value (vb, DS_TYPE_COUNTER, 1.0, 0.0);
 +    value_t val = csnmp_value_list_to_value (vb, DS_TYPE_COUNTER,
 +        /* scale = */ 1.0, /* shift = */ 0.0, hd->name, dd->name);
      ssnprintf (il->instance, sizeof (il->instance),
        "%llu", val.counter);
    }
@@@ -1309,7 -1305,7 +1311,7 @@@ static int csnmp_read_table (host_defin
        /* Allocate a new `csnmp_list_instances_t', insert the instance name and
         * add it to the list */
        if (csnmp_instance_list_add (&instance_list, &instance_list_ptr,
 -          res) != 0)
 +          res, host, data) != 0)
        {
        ERROR ("snmp plugin: csnmp_instance_list_add failed.");
        status = -1;
  
        vt->subid = vb->name[vb->name_length - 1];
        vt->value = csnmp_value_list_to_value (vb, ds->ds[i].type,
 -        data->scale, data->shift);
 +          data->scale, data->shift, host->name, data->name);
        vt->next = NULL;
  
        if (value_table_ptr[i] == NULL)
@@@ -1515,8 -1511,8 +1517,8 @@@ static int csnmp_read_value (host_defin
      for (i = 0; i < data->values_len; i++)
        if (snmp_oid_compare (data->values[i].oid, data->values[i].oid_len,
            vb->name, vb->name_length) == 0)
 -      vl.values[i] = csnmp_value_list_to_value (vb, ds->ds[i].type,
 -          data->scale, data->shift);
 +        vl.values[i] = csnmp_value_list_to_value (vb, ds->ds[i].type,
 +            data->scale, data->shift, host->name, data->name);
    } /* for (res->variables) */
  
    if (res != NULL)
diff --combined src/utils_avltree.c
index 0436d8fe077eceeaffdeff607bc8f9e44ebe5aca,12310d3fa771d528fabc5ac313f76d42ed71aef6..ba7cd95fde9f81cc1e68f0dc34fb6ec8f57ff3ad
@@@ -51,7 -51,6 +51,7 @@@ struct c_avl_tree_
  {
        c_avl_node_t *root;
        int (*compare) (const void *, const void *);
 +      int size;
  };
  
  struct c_avl_iterator_s
@@@ -480,13 -479,14 +480,15 @@@ c_avl_tree_t *c_avl_create (int (*compa
  
        t->root = NULL;
        t->compare = compare;
 +      t->size = 0;
  
        return (t);
  }
  
  void c_avl_destroy (c_avl_tree_t *t)
  {
+       if (t == NULL)
+               return;
        free_node (t->root);
        free (t);
  }
@@@ -555,7 -555,6 +557,7 @@@ int c_avl_insert (c_avl_tree_t *t, voi
        } /* while (42) */
  
        verify_tree (t->root);
 +      ++t->size;
        return (0);
  } /* int c_avl_insert */
  
@@@ -577,7 -576,6 +579,7 @@@ int c_avl_remove (c_avl_tree_t *t, cons
  
        status = _remove (t, n);
        verify_tree (t->root);
 +      --t->size;
        return (status);
  } /* void *c_avl_remove */
  
@@@ -714,10 -712,3 +716,10 @@@ void c_avl_iterator_destroy (c_avl_iter
  {
        free (iter);
  }
 +
 +int c_avl_size (c_avl_tree_t *t)
 +{
 +      if (t == NULL)
 +              return (0);
 +      return (t->size);
 +}