Merge branch 'collectd-4.4'
authorFlorian Forster <octo@huhu.verplant.org>
Tue, 19 Aug 2008 07:27:14 +0000 (09:27 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 19 Aug 2008 07:27:14 +0000 (09:27 +0200)
Conflicts:

src/tcpconns.c

1  2 
configure.in
src/Makefile.am
src/snmp.c
src/swap.c
src/tcpconns.c

diff --combined configure.in
@@@ -69,7 -69,7 +69,7 @@@ AC_HEADER_STD
  AC_HEADER_SYS_WAIT
  AC_HEADER_DIRENT
  
 -AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
 +AC_CHECK_HEADERS(stdio.h stdint.h stdbool.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
  
  # For ping library
  AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
    AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
  fi
  
- AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
- if test "x$with_libkvm" = "xyes"
+ AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
+ if test "x$with_kvm_getswapinfo" = "xyes"
  then
-       AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
+       AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
+                 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
  fi
- AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
+ AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
  
  with_sensors_cflags=""
  with_sensors_ldflags=""
  AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
  AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
  
 +with_libowcapi_cppflags=""
 +with_libowcapi_libs="-lowcapi"
 +AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
 +[
 +      if test "x$withval" != "xno" && test "x$withval" != "xyes"
 +      then
 +              with_libowcapi_cppflags="-I$withval/include"
 +              with_libowcapi_libs="-L$withval/lib -lowcapi"
 +              with_libowcapi="yes"
 +      else
 +              with_libowcapi="$withval"
 +      fi
 +],
 +[
 +      with_libowcapi="yes"
 +])
 +if test "x$with_libowcapi" = "xyes"
 +then
 +      SAVE_CPPFLAGS="$CPPFLAGS"
 +      CPPFLAGS="$with_libowcapi_cppflags"
 +      
 +      AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
 +
 +      CPPFLAGS="$SAVE_CPPFLAGS"
 +fi
 +if test "x$with_libowcapi" = "xyes"
 +then
 +      SAVE_LDFLAGS="$LDFLAGS"
 +      SAVE_CPPFLAGS="$CPPFLAGS"
 +      LDFLAGS="$with_libowcapi_libs"
 +      CPPFLAGS="$with_libowcapi_cppflags"
 +      
 +      AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
 +
 +      LDFLAGS="$SAVE_LDFLAGS"
 +      CPPFLAGS="$SAVE_CPPFLAGS"
 +fi
 +if test "x$with_libowcapi" = "xyes"
 +then
 +      BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
 +      BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
 +      AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
 +      AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
 +fi
 +
 +
  AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
  [
        if test "x$withval" != "xno" && test "x$withval" != "xyes"
@@@ -1551,44 -1506,6 +1552,44 @@@ AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$c
        [Wether or not to use the pcap library])
  AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
  
 +AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
 +[
 +      if test "x$withval" != "xno" && test "x$withval" != "xyes"
 +      then
 +              LDFLAGS="$LDFLAGS -L$withval/lib"
 +              CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
 +              with_libesmtp="yes"
 +      else
 +              with_libesmtp="$withval"
 +      fi
 +],
 +[
 +      with_libesmtp="yes"
 +])
 +if test "x$with_libesmtp" = "xyes"
 +then
 +      AC_CHECK_LIB(esmtp, smtp_create_session,
 +      [
 +              AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
 +      ], [with_libesmtp="no (libesmtp not found)"])
 +fi
 +if test "x$with_libesmtp" = "xyes"
 +then
 +      AC_CHECK_HEADERS(libesmtp.h,
 +      [
 +              AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
 +      ], [with_libesmtp="no (libesmtp.h not found)"])
 +fi
 +if test "x$with_libesmtp" = "xyes"
 +then
 +      collect_libesmtp=1
 +else
 +      collect_libesmtp=0
 +fi
 +AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
 +      [Wether or not to use the esmtp library])
 +AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
 +
  perl_interpreter="perl"
  AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
  [
  fi
  AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
  
 +PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
 +              [with_libnotify="yes"],
 +              [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
 +
  with_libupsclient="no (pkg-config isn't available)"
  with_libupsclient_cflags=""
  with_libupsclient_libs=""
        AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
  fi
  
 +dnl Check for libpq.
 +with_pg_config="pg_config"
 +with_libpq_includedir=""
 +with_libpq_libdir=""
 +with_libpq_cppflags=""
 +with_libpq_ldflags=""
 +AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
 +      [Path to libpq.])],
 +[
 +      if test "x$withval" = "xno"
 +      then
 +              with_libpq="no"
 +      else if test "x$withval" = "xyes"
 +      then
 +              with_libpq="yes"
 +      else
 +              if test -f "$withval" && test -x "$withval";
 +              then
 +                      with_pg_config="$withval"
 +              else if test -x "$withval/bin/pg_config"
 +              then
 +                      with_pg_config="$withval/bin/pg_config"
 +              fi; fi
 +              with_libpq="yes"
 +      fi; fi
 +],
 +[
 +      with_libpq="yes"
 +])
 +if test "x$with_libpq" = "xyes"
 +then
 +      with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
 +      pg_config_status=$?
 +
 +      if test $pg_config_status -eq 0
 +      then
 +              if test -n "$with_libpq_includedir"; then
 +                      for dir in $with_libpq_includedir; do
 +                              with_libpq_cppflags="$with_libpq_cppflags -I$dir"
 +                      done
 +              fi
 +      else
 +              AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
 +      fi
 +
 +      SAVE_CPPFLAGS="$CPPFLAGS"
 +      CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
 +
 +      AC_CHECK_HEADERS(libpq-fe.h, [],
 +              [with_libpq="no (libpq-fe.h not found)"], [])
 +
 +      CPPFLAGS="$SAVE_CPPFLAGS"
 +fi
 +if test "x$with_libpq" = "xyes"
 +then
 +      with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
 +      pg_config_status=$?
 +
 +      if test $pg_config_status -eq 0
 +      then
 +              if test -n "$with_libpq_libdir"; then
 +                      for dir in $with_libpq_libdir; do
 +                              with_libpq_ldflags="$with_libpq_ldflags -L$dir"
 +                      done
 +              fi
 +      else
 +              AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
 +      fi
 +
 +      SAVE_LDFLAGS="$LDFLAGS"
 +      LDFLAGS="$LDFLAGS $with_libpq_ldflags"
 +
 +      AC_CHECK_LIB(pq, PQconnectdb,
 +              [with_libpq="yes"],
 +              [with_libpq="no (symbol 'PQconnectdb' not found)"])
 +
 +      LDFLAGS="$SAVE_LDFLAGS"
 +fi
 +if test "x$with_libpq" = "xyes"
 +then
 +      BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
 +      BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
 +      AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
 +      AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
 +fi
 +AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
 +
  dnl Check for libvirt and libxml2 libraries.
  with_libxml2="no (pkg-config isn't available)"
  with_libxml2_cflags=""
@@@ -2486,7 -2312,6 +2487,7 @@@ plugin_serial="no
  plugin_swap="no"
  plugin_tape="no"
  plugin_tcpconns="no"
 +plugin_thermal="no"
  plugin_users="no"
  plugin_vmem="no"
  plugin_vserver="no"
@@@ -2509,7 -2334,6 +2510,7 @@@ the
        plugin_serial="yes"
        plugin_swap="yes"
        plugin_tcpconns="yes"
 +      plugin_thermal="yes"
        plugin_vmem="yes"
        plugin_vserver="yes"
        plugin_wireless="yes"
  
  if test "x$with_libkvm" = "xyes"
  then
 +      plugin_processes="yes"
        plugin_swap="yes"
  fi
  
@@@ -2644,7 -2467,6 +2645,7 @@@ AC_PLUGIN([battery],     [$plugin_batte
  AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
  AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
  AC_PLUGIN([csv],         [yes],                [CSV output plugin])
 +AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
  AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
  AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
  AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
@@@ -2669,16 -2491,12 +2670,16 @@@ AC_PLUGIN([netlink],     [$with_libnetl
  AC_PLUGIN([network],     [yes],                [Network communication plugin])
  AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
  AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
 +AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
  AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
  AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
 +AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
  AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
  AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
 +AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
  AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
  AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
 +AC_PLUGIN([qmail],       [yes],                [QMail queue statistics])
  AC_PLUGIN([rrdtool],     [$with_rrdtool],      [RRDTool output plugin])
  AC_PLUGIN([sensors],     [$with_lm_sensors],   [lm_sensors statistics])
  AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
@@@ -2689,7 -2507,6 +2690,7 @@@ AC_PLUGIN([tail],        [yes]
  AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
  AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
  AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
 +AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
  AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
  AC_PLUGIN([users],       [$plugin_users],      [User statistics])
  AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
@@@ -2771,99 -2588,90 +2772,99 @@@ cat <<EOF
  
  Configuration:
    Libraries:
 -    libcurl . . . . . . $with_libcurl
 -    libiokit  . . . . . $with_libiokit
 -    libiptc . . . . . . $with_libiptc
 -    libkstat  . . . . . $with_kstat
 -    libkvm  . . . . . . $with_libkvm
 -    libmysql  . . . . . $with_libmysql
 -    libnetlink  . . . . $with_libnetlink
 -    libnetsnmp  . . . . $with_libnetsnmp
 -    liboconfig  . . . . $with_liboconfig
 -    libopenipmi . . . . $with_libopenipmipthread
 -    liboping  . . . . . $with_liboping
 -    libpcap . . . . . . $with_libpcap
 -    libperl . . . . . . $with_libperl
 -    libpthread  . . . . $with_libpthread
 -    librrd  . . . . . . $with_rrdtool
 -    libsensors  . . . . $with_lm_sensors
 -    libstatgrab . . . . $with_libstatgrab
 -    libupsclient  . . . $with_libupsclient
 -    libvirt . . . . . . $with_libvirt
 -    libxml2 . . . . . . $with_libxml2
 -    libxmms . . . . . . $with_libxmms
 +    libcurl . . . . . . . $with_libcurl
 +    libesmtp  . . . . . . $with_libesmtp
 +    libiokit  . . . . . . $with_libiokit
 +    libiptc . . . . . . . $with_libiptc
 +    libkstat  . . . . . . $with_kstat
 +    libkvm  . . . . . . . $with_libkvm
 +    libmysql  . . . . . . $with_libmysql
 +    libnetlink  . . . . . $with_libnetlink
 +    libnetsnmp  . . . . . $with_libnetsnmp
 +    libnotify . . . . . . $with_libnotify
 +    liboconfig  . . . . . $with_liboconfig
 +    libopenipmi . . . . . $with_libopenipmipthread
 +    liboping  . . . . . . $with_liboping
 +    libpcap . . . . . . . $with_libpcap
 +    libperl . . . . . . . $with_libperl
 +    libpthread  . . . . . $with_libpthread
 +    libpq . . . . . . . . $with_libpq
 +    librrd  . . . . . . . $with_rrdtool
 +    libsensors  . . . . . $with_lm_sensors
 +    libstatgrab . . . . . $with_libstatgrab
 +    libupsclient  . . . . $with_libupsclient
 +    libvirt . . . . . . . $with_libvirt
 +    libxml2 . . . . . . . $with_libxml2
 +    libxmms . . . . . . . $with_libxmms
  
    Features:
 -    daemon mode . . . . $enable_daemon
 -    debug . . . . . . . $enable_debug
 +    daemon mode . . . . $enable_daemon
 +    debug . . . . . . . $enable_debug
  
    Bindings:
 -    perl  . . . . . . . $with_perl_bindings
 +    perl  . . . . . . . $with_perl_bindings
  
    Modules:
 -    apache  . . . . . . $enable_apache
 -    apcups  . . . . . . $enable_apcups
 -    apple_sensors . . . $enable_apple_sensors
 -    ascent  . . . . . . $enable_ascent
 -    battery . . . . . . $enable_battery
 -    cpu . . . . . . . . $enable_cpu
 -    cpufreq . . . . . . $enable_cpufreq
 -    csv . . . . . . . . $enable_csv
 -    df  . . . . . . . . $enable_df
 -    disk  . . . . . . . $enable_disk
 -    dns . . . . . . . . $enable_dns
 -    email . . . . . . . $enable_email
 -    entropy . . . . . . $enable_entropy
 -    exec  . . . . . . . $enable_exec
 -    hddtemp . . . . . . $enable_hddtemp
 -    interface . . . . . $enable_interface
 -    iptables  . . . . . $enable_iptables
 -    ipmi  . . . . . . . $enable_ipmi
 -    ipvs  . . . . . . . $enable_ipvs
 -    irq . . . . . . . . $enable_irq
 -    libvirt . . . . . . $enable_libvirt
 -    load  . . . . . . . $enable_load
 -    logfile . . . . . . $enable_logfile
 -    mbmon . . . . . . . $enable_mbmon
 -    memcached . . . . . $enable_memcached
 -    memory  . . . . . . $enable_memory
 -    multimeter  . . . . $enable_multimeter
 -    mysql . . . . . . . $enable_mysql
 -    netlink . . . . . . $enable_netlink
 -    network . . . . . . $enable_network
 -    nfs . . . . . . . . $enable_nfs
 -    nginx . . . . . . . $enable_nginx
 -    ntpd  . . . . . . . $enable_ntpd
 -    nut . . . . . . . . $enable_nut
 -    perl  . . . . . . . $enable_perl
 -    ping  . . . . . . . $enable_ping
 -    powerdns  . . . . . $enable_powerdns
 -    processes . . . . . $enable_processes
 -    rrdtool . . . . . . $enable_rrdtool
 -    sensors . . . . . . $enable_sensors
 -    serial  . . . . . . $enable_serial
 -    snmp  . . . . . . . $enable_snmp
 -    swap  . . . . . . . $enable_swap
 -    syslog  . . . . . . $enable_syslog
 -    tail  . . . . . . . $enable_tail
 -    tape  . . . . . . . $enable_tape
 -    tcpconns  . . . . . $enable_tcpconns
 -    teamspeak2  . . . . $enable_teamspeak2
 -    unixsock  . . . . . $enable_unixsock
 -    users . . . . . . . $enable_users
 -    uuid  . . . . . . . $enable_uuid
 -    vmem  . . . . . . . $enable_vmem
 -    vserver . . . . . . $enable_vserver
 -    wireless  . . . . . $enable_wireless
 -    xmms  . . . . . . . $enable_xmms
 +    apache  . . . . . . . $enable_apache
 +    apcups  . . . . . . . $enable_apcups
 +    apple_sensors . . . . $enable_apple_sensors
 +    ascent  . . . . . . . $enable_ascent
 +    battery . . . . . . . $enable_battery
 +    cpu . . . . . . . . . $enable_cpu
 +    cpufreq . . . . . . . $enable_cpufreq
 +    csv . . . . . . . . . $enable_csv
 +    df  . . . . . . . . . $enable_df
 +    disk  . . . . . . . . $enable_disk
 +    dns . . . . . . . . . $enable_dns
 +    email . . . . . . . . $enable_email
 +    entropy . . . . . . . $enable_entropy
 +    exec  . . . . . . . . $enable_exec
 +    hddtemp . . . . . . . $enable_hddtemp
 +    interface . . . . . . $enable_interface
 +    iptables  . . . . . . $enable_iptables
 +    ipmi  . . . . . . . . $enable_ipmi
 +    ipvs  . . . . . . . . $enable_ipvs
 +    irq . . . . . . . . . $enable_irq
 +    libvirt . . . . . . . $enable_libvirt
 +    load  . . . . . . . . $enable_load
 +    logfile . . . . . . . $enable_logfile
 +    mbmon . . . . . . . . $enable_mbmon
 +    memcached . . . . . . $enable_memcached
 +    memory  . . . . . . . $enable_memory
 +    multimeter  . . . . . $enable_multimeter
 +    mysql . . . . . . . . $enable_mysql
 +    netlink . . . . . . . $enable_netlink
 +    network . . . . . . . $enable_network
 +    nfs . . . . . . . . . $enable_nfs
 +    nginx . . . . . . . . $enable_nginx
 +    notify_desktop  . . . $enable_notify_desktop
 +    notify_email  . . . . $enable_notify_email
 +    ntpd  . . . . . . . . $enable_ntpd
 +    nut . . . . . . . . . $enable_nut
 +    onewire . . . . . . . $enable_onewire
 +    perl  . . . . . . . . $enable_perl
 +    ping  . . . . . . . . $enable_ping
 +    postgresql  . . . . . $enable_postgresql
 +    powerdns  . . . . . . $enable_powerdns
 +    processes . . . . . . $enable_processes
 +    qmail . . . . . . . . $enable_qmail
 +    rrdtool . . . . . . . $enable_rrdtool
 +    sensors . . . . . . . $enable_sensors
 +    serial  . . . . . . . $enable_serial
 +    snmp  . . . . . . . . $enable_snmp
 +    swap  . . . . . . . . $enable_swap
 +    syslog  . . . . . . . $enable_syslog
 +    tail  . . . . . . . . $enable_tail
 +    tape  . . . . . . . . $enable_tape
 +    tcpconns  . . . . . . $enable_tcpconns
 +    teamspeak2  . . . . . $enable_teamspeak2
 +    thermal . . . . . . . $enable_thermal
 +    unixsock  . . . . . . $enable_unixsock
 +    users . . . . . . . . $enable_users
 +    uuid  . . . . . . . . $enable_uuid
 +    vmem  . . . . . . . . $enable_vmem
 +    vserver . . . . . . . $enable_vserver
 +    wireless  . . . . . . $enable_wireless
 +    xmms  . . . . . . . . $enable_xmms
  
  EOF
diff --combined src/Makefile.am
@@@ -21,7 -21,6 +21,7 @@@ if BUILD_FEATURE_DAEMO
  AM_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
  endif
  AM_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"'
 +AM_CPPFLAGS += -DPKGDATADIR='"${pkgdatadir}"'
  
  sbin_PROGRAMS = collectd collectdmon
  bin_PROGRAMS = collectd-nagios
@@@ -32,7 -31,6 +32,7 @@@ collectd_SOURCES = collectd.c collectd.
                   plugin.c plugin.h \
                   utils_avltree.c utils_avltree.h \
                   utils_cache.c utils_cache.h \
 +                 utils_complain.c utils_complain.h \
                   utils_ignorelist.c utils_ignorelist.h \
                   utils_llist.c utils_llist.h \
                   utils_tail_match.c utils_tail_match.h \
@@@ -43,7 -41,7 +43,7 @@@
                   types_list.c types_list.h
  
  collectd_CPPFLAGS =  $(AM_CPPFLAGS) $(LTDLINCL)
 -collectd_CFLAGS =
 +collectd_CFLAGS = $(AM_CFLAGS)
  collectd_LDFLAGS = -export-dynamic
  collectd_LDADD =
  collectd_DEPENDENCIES =
@@@ -97,7 -95,7 +97,7 @@@ if BUILD_PLUGIN_APACH
  pkglib_LTLIBRARIES += apache.la
  apache_la_SOURCES = apache.c
  apache_la_LDFLAGS = -module -avoid-version
 -apache_la_CFLAGS =
 +apache_la_CFLAGS = $(AM_CFLAGS)
  apache_la_LIBADD =
  collectd_LDADD += "-dlopen" apache.la
  if BUILD_WITH_LIBCURL
@@@ -130,8 -128,7 +130,8 @@@ if BUILD_PLUGIN_ASCEN
  pkglib_LTLIBRARIES += ascent.la
  ascent_la_SOURCES = ascent.c
  ascent_la_LDFLAGS = -module -avoid-version
 -ascent_la_CFLAGS = $(BUILD_WITH_LIBCURL_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
 +ascent_la_CFLAGS = $(AM_CFLAGS) \
 +              $(BUILD_WITH_LIBCURL_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
  ascent_la_LIBADD = $(BUILD_WITH_LIBCURL_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
  collectd_LDADD += "-dlopen" apache.la
  collectd_DEPENDENCIES += ascent.la
@@@ -151,7 -148,7 +151,7 @@@ endi
  if BUILD_PLUGIN_CPU
  pkglib_LTLIBRARIES += cpu.la
  cpu_la_SOURCES = cpu.c
 -cpu_la_CFLAGS =
 +cpu_la_CFLAGS = $(AM_CFLAGS)
  cpu_la_LDFLAGS = -module -avoid-version
  cpu_la_LIBADD = 
  if BUILD_WITH_LIBKSTAT
@@@ -195,7 -192,7 +195,7 @@@ endi
  if BUILD_PLUGIN_DISK
  pkglib_LTLIBRARIES += disk.la
  disk_la_SOURCES = disk.c
 -disk_la_CFLAGS =
 +disk_la_CFLAGS = $(AM_CFLAGS)
  disk_la_LDFLAGS = -module -avoid-version
  disk_la_LIBADD = 
  if BUILD_WITH_LIBKSTAT
@@@ -269,7 -266,7 +269,7 @@@ endi
  if BUILD_PLUGIN_INTERFACE
  pkglib_LTLIBRARIES += interface.la
  interface_la_SOURCES = interface.c
 -interface_la_CFLAGS =
 +interface_la_CFLAGS = $(AM_CFLAGS)
  interface_la_LDFLAGS = -module -avoid-version
  interface_la_LIBADD =
  collectd_LDADD += "-dlopen" interface.la
@@@ -304,7 -301,7 +304,7 @@@ endi
  if BUILD_PLUGIN_IPMI
  pkglib_LTLIBRARIES += ipmi.la
  ipmi_la_SOURCES = ipmi.c
 -ipmi_la_CFLAGS = $(BUILD_WITH_OPENIPMI_CFLAGS)
 +ipmi_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_OPENIPMI_CFLAGS)
  ipmi_la_LDFLAGS = -module -avoid-version
  ipmi_la_LIBADD = $(BUILD_WITH_OPENIPMI_LIBS)
  collectd_LDADD += "-dlopen" ipmi.la
@@@ -331,8 -328,7 +331,8 @@@ endi
  if BUILD_PLUGIN_LIBVIRT
  pkglib_LTLIBRARIES += libvirt.la
  libvirt_la_SOURCES = libvirt.c
 -libvirt_la_CFLAGS = $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
 +libvirt_la_CFLAGS = $(AM_CFLAGS) \
 +              $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
  libvirt_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
  libvirt_la_LDFLAGS = -module -avoid-version
  collectd_LDADD += "-dlopen" libvirt.la
@@@ -342,7 -338,7 +342,7 @@@ endi
  if BUILD_PLUGIN_LOAD
  pkglib_LTLIBRARIES += load.la
  load_la_SOURCES = load.c
 -load_la_CFLAGS =
 +load_la_CFLAGS = $(AM_CFLAGS)
  load_la_LDFLAGS = -module -avoid-version
  load_la_LIBADD =
  collectd_LDADD += "-dlopen" load.la
@@@ -376,6 -372,7 +376,6 @@@ if BUILD_PLUGIN_MEMCACHE
  pkglib_LTLIBRARIES += memcached.la
  memcached_la_SOURCES = memcached.c
  memcached_la_LDFLAGS = -module -avoid-version
 -memcached_la_CFLAGS =
  memcached_la_LIBADD =
  if BUILD_WITH_LIBSOCKET
  memcached_la_LDFLAGS += -lsocket
@@@ -387,7 -384,7 +387,7 @@@ endi
  if BUILD_PLUGIN_MEMORY
  pkglib_LTLIBRARIES += memory.la
  memory_la_SOURCES = memory.c
 -memory_la_CFLAGS =
 +memory_la_CFLAGS = $(AM_CFLAGS)
  memory_la_LDFLAGS = -module -avoid-version
  memory_la_LIBADD =
  collectd_LDADD += "-dlopen" memory.la
@@@ -416,7 -413,7 +416,7 @@@ if BUILD_PLUGIN_MYSQ
  pkglib_LTLIBRARIES += mysql.la
  mysql_la_SOURCES = mysql.c
  mysql_la_LDFLAGS = -module -avoid-version
 -mysql_la_CFLAGS =
 +mysql_la_CFLAGS = $(AM_CFLAGS)
  mysql_la_LIBADD =
  collectd_LDADD += "-dlopen" mysql.la
  if BUILD_WITH_LIBMYSQL
@@@ -430,7 -427,7 +430,7 @@@ if BUILD_PLUGIN_NETLIN
  pkglib_LTLIBRARIES += netlink.la
  netlink_la_SOURCES = netlink.c
  netlink_la_LDFLAGS = -module -avoid-version
 -netlink_la_CFLAGS = $(BUILD_WITH_LIBNETLINK_CFLAGS)
 +netlink_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBNETLINK_CFLAGS)
  netlink_la_LIBADD = $(BUILD_WITH_LIBNETLINK_LIBS)
  collectd_LDADD += "-dlopen" netlink.la
  collectd_DEPENDENCIES += netlink.la
@@@ -472,23 -469,6 +472,23 @@@ collectd_LDADD += "-dlopen" nginx.l
  collectd_DEPENDENCIES += nginx.la
  endif
  
 +if BUILD_PLUGIN_NOTIFY_DESKTOP
 +pkglib_LTLIBRARIES += notify_desktop.la
 +notify_desktop_la_SOURCES = notify_desktop.c
 +notify_desktop_la_CFLAGS = $(AM_CFLAGS) $(LIBNOTIFY_CFLAGS)
 +notify_desktop_la_LDFLAGS = -module -avoid-version $(LIBNOTIFY_LIBS)
 +collectd_LDADD += "-dlopen" notify_desktop.la
 +collectd_DEPENDENCIES += notify_desktop.la
 +endif
 +
 +if BUILD_PLUGIN_NOTIFY_EMAIL
 +pkglib_LTLIBRARIES += notify_email.la
 +notify_email_la_SOURCES = notify_email.c
 +notify_email_la_LDFLAGS = -L/usr/local/lib -lesmtp -lssl -lcrypto -pthread -module -avoid-version
 +collectd_LDADD += "-dlopen" notify_email.la
 +collectd_DEPENDENCIES += notify_email.la
 +endif
 +
  if BUILD_PLUGIN_NTPD
  pkglib_LTLIBRARIES += ntpd.la
  ntpd_la_SOURCES = ntpd.c
@@@ -509,28 -489,14 +509,28 @@@ collectd_LDADD += "-dlopen" nut.l
  collectd_DEPENDENCIES += nut.la
  endif
  
 +if BUILD_PLUGIN_ONEWIRE
 +pkglib_LTLIBRARIES += onewire.la
 +onewire_la_SOURCES = onewire.c
 +onewire_la_CFLAGS = $(AM_CFLAGS)
 +onewire_la_CPPFLAGS = $(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
 +onewire_la_LIBADD = $(BUILD_WITH_LIBOWCAPI_LIBS)
 +onewire_la_LDFLAGS = -module -avoid-version
 +collectd_LDADD += "-dlopen" onewire.la
 +collectd_DEPENDENCIES += onewire.la
 +endif
 +
  if BUILD_PLUGIN_PERL
  pkglib_LTLIBRARIES += perl.la
  perl_la_SOURCES = perl.c
 +# Despite C99 providing the "bool" type thru stdbool.h, Perl defines its own
 +# version of that type if HAS_BOOL is not defined... *sigh*
 +perl_la_CPPFLAGS = $(AM_CPPFLAGS) -DHAS_BOOL=1
  perl_la_CFLAGS  = $(AM_CFLAGS) \
 -                $(PERL_CFLAGS) \
 -                -DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
 +              $(PERL_CFLAGS) \
 +              -DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
  perl_la_LDFLAGS = -module -avoid-version \
 -                $(PERL_LDFLAGS)
 +              $(PERL_LDFLAGS)
  collectd_LDADD += "-dlopen" perl.la
  collectd_DEPENDENCIES += perl.la
  endif
@@@ -549,16 -515,6 +549,16 @@@ collectd_LDADD += "-dlopen" ping.l
  collectd_DEPENDENCIES += ping.la
  endif
  
 +if BUILD_PLUGIN_POSTGRESQL
 +pkglib_LTLIBRARIES += postgresql.la
 +postgresql_la_SOURCES = postgresql.c
 +postgresql_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBPQ_CPPFLAGS)
 +postgresql_la_LDFLAGS = -module -avoid-version \
 +              $(BUILD_WITH_LIBPQ_LDFLAGS) -lpq
 +collectd_LDADD += "-dlopen" postgresql.la
 +collectd_DEPENDENCIES += postgresql.la
 +endif
 +
  if BUILD_PLUGIN_POWERDNS
  pkglib_LTLIBRARIES += powerdns.la
  powerdns_la_SOURCES = powerdns.c
@@@ -575,19 -531,11 +575,19 @@@ collectd_LDADD += "-dlopen" processes.l
  collectd_DEPENDENCIES += processes.la
  endif
  
 +if BUILD_PLUGIN_QMAIL
 +pkglib_LTLIBRARIES += qmail.la
 +qmail_la_SOURCES = qmail.c
 +qmail_la_LDFLAGS = -module -avoid-version
 +collectd_LDADD += "-dlopen" qmail.la
 +collectd_DEPENDENCIES += qmail.la
 +endif
 +
  if BUILD_PLUGIN_RRDTOOL
  pkglib_LTLIBRARIES += rrdtool.la
  rrdtool_la_SOURCES = rrdtool.c
  rrdtool_la_LDFLAGS = -module -avoid-version
 -rrdtool_la_CFLAGS = $(BUILD_WITH_LIBRRD_CFLAGS)
 +rrdtool_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBRRD_CFLAGS)
  rrdtool_la_LIBADD = $(BUILD_WITH_LIBRRD_LDFLAGS)
  collectd_LDADD += "-dlopen" rrdtool.la
  collectd_DEPENDENCIES += rrdtool.la
@@@ -596,7 -544,7 +596,7 @@@ endi
  if BUILD_PLUGIN_SENSORS
  pkglib_LTLIBRARIES += sensors.la
  sensors_la_SOURCES = sensors.c
 -sensors_la_CFLAGS = $(BUILD_WITH_LIBSENSORS_CFLAGS)
 +sensors_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBSENSORS_CFLAGS)
  sensors_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBSENSORS_LDFLAGS)
  sensors_la_LIBADD = -lsensors
  collectd_LDADD += "-dlopen" sensors.la
@@@ -615,7 -563,7 +615,7 @@@ if BUILD_PLUGIN_SNM
  pkglib_LTLIBRARIES += snmp.la
  snmp_la_SOURCES = snmp.c
  snmp_la_LDFLAGS = -module -avoid-version
 -snmp_la_CFLAGS =
 +snmp_la_CFLAGS = $(AM_CFLAGS)
  snmp_la_LIBADD =
  if BUILD_WITH_LIBNETSNMP
  snmp_la_CFLAGS += $(BUILD_WITH_LIBSNMP_CFLAGS)
@@@ -631,7 -579,7 +631,7 @@@ endi
  if BUILD_PLUGIN_SWAP
  pkglib_LTLIBRARIES += swap.la
  swap_la_SOURCES = swap.c
 -swap_la_CFLAGS =
 +swap_la_CFLAGS = $(AM_CFLAGS)
  swap_la_LDFLAGS = -module -avoid-version
  swap_la_LIBADD =
  collectd_LDADD += "-dlopen" swap.la
@@@ -642,7 -590,7 +642,7 @@@ endi
  if BUILD_WITH_LIBDEVINFO
  swap_la_LIBADD += -ldevinfo
  endif
- if BUILD_WITH_LIBKVM
+ if BUILD_WITH_LIBKVM_GETSWAPINFO
  swap_la_LIBADD += -lkvm
  endif
  if BUILD_WITH_LIBSTATGRAB
@@@ -691,14 -639,6 +691,14 @@@ collectd_LDADD += "-dlopen" teamspeak2.
  collectd_DEPENDENCIES += teamspeak2.la
  endif
  
 +if BUILD_PLUGIN_THERMAL
 +pkglib_LTLIBRARIES += thermal.la
 +thermal_la_SOURCES = thermal.c
 +thermal_la_LDFLAGS = -module -avoid-version
 +collectd_LDADD += "-dlopen" thermal.la
 +collectd_DEPENDENCIES += thermal.la
 +endif
 +
  if BUILD_PLUGIN_UNIXSOCK
  pkglib_LTLIBRARIES += unixsock.la
  unixsock_la_SOURCES = unixsock.c \
@@@ -715,7 -655,7 +715,7 @@@ endi
  if BUILD_PLUGIN_USERS
  pkglib_LTLIBRARIES += users.la
  users_la_SOURCES = users.c
 -users_la_CFLAGS =
 +users_la_CFLAGS = $(AM_CFLAGS)
  users_la_LDFLAGS = -module -avoid-version
  users_la_LIBADD =
  if BUILD_WITH_LIBSTATGRAB
@@@ -781,8 -721,7 +781,8 @@@ EXTRA_DIST = types.d
  
  EXTRA_DIST += collectd-email.pod collectd-exec.pod collectd-nagios.pod \
        collectd-perl.pod collectd-snmp.pod collectd-unixsock.pod \
 -      collectd.conf.pod collectd.pod collectdmon.pod types.db.pod
 +      collectd.conf.pod collectd.pod collectdmon.pod types.db.pod \
 +      postgresql_default.conf
  
  .pod.1:
        pod2man --release=$(VERSION) --center=$(PACKAGE) $< >.pod2man.tmp 2>/dev/null && mv -f .pod2man.tmp $@ || true
@@@ -799,5 -738,3 +799,5 @@@ install-exec-hook
                $(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
        fi; \
        cp -f $(srcdir)/types.db $(DESTDIR)$(pkglibdir)/;
 +      $(INSTALL) -D -m 0644 $(srcdir)/postgresql_default.conf \
 +              $(DESTDIR)$(pkgdatadir)/postgresql_default.conf;
diff --combined src/snmp.c
@@@ -198,8 -198,7 +198,8 @@@ static int csnmp_config_add_data_instan
    else
    {
      /* Instance is a simple string */
 -    strncpy (dd->instance.string, ci->values[0].value.string, DATA_MAX_NAME_LEN - 1);
 +    sstrncpy (dd->instance.string, ci->values[0].value.string,
 +      sizeof (dd->instance.string));
    }
  
    return (0);
@@@ -717,42 -716,13 +717,42 @@@ static value_t csnmp_value_list_to_valu
      temp += (uint32_t) vl->val.counter64->low;
      DEBUG ("snmp plugin: Parsed int64 value is %"PRIu64".", temp);
    }
 +  else if (vl->type == ASN_OCTET_STR)
 +  {
 +    /* We'll handle this later.. */
 +  }
    else
    {
      WARNING ("snmp plugin: I don't know the ASN type `%i'", (int) vl->type);
      defined = 0;
    }
  
 -  if (type == DS_TYPE_COUNTER)
 +  if (vl->type == ASN_OCTET_STR)
 +  {
 +    char *string;
 +    char *endptr;
 +
 +    string = (char *) vl->val.string;
 +    endptr = NULL;
 +
 +    if (string != NULL)
 +    {
 +      if (type == DS_TYPE_COUNTER)
 +      ret.counter = (counter_t) strtoll (string, &endptr, /* base = */ 0);
 +      else if (type == DS_TYPE_GAUGE)
 +      ret.gauge = (gauge_t) strtod (string, &endptr);
 +    }
 +
 +    /* Check if an error occurred */
 +    if ((string == NULL) || (endptr == string))
 +    {
 +      if (type == DS_TYPE_COUNTER)
 +      ret.counter = 0;
 +      else if (type == DS_TYPE_GAUGE)
 +      ret.gauge = NAN;
 +    }
 +  }
 +  else if (type == DS_TYPE_COUNTER)
    {
      ret.counter = temp;
    }
@@@ -863,18 -833,11 +863,18 @@@ static int csnmp_instance_list_add (csn
      if (instance_len > vb->val_len)
        instance_len = vb->val_len;
  
 -    strncpy (il->instance, (char *) ((vb->type == ASN_OCTET_STR)
 +    if (instance_len < 1)
 +    {
 +      ERROR ("snmp plugin: csnmp_instance_list_add: instance_len = %zu, "
 +        "which is less than one.", instance_len);
 +      sfree (il);
 +      return (-1);
 +    }
 +
 +    sstrncpy (il->instance, (char *) ((vb->type == ASN_OCTET_STR)
          ? vb->val.string
          : vb->val.bitstring),
        instance_len);
 -    il->instance[instance_len] = '\0';
  
      for (ptr = il->instance; *ptr != '\0'; ptr++)
      {
    else
    {
      value_t val = csnmp_value_list_to_value (vb, DS_TYPE_COUNTER, 1.0, 0.0);
 -    snprintf (il->instance, sizeof (il->instance),
 +    ssnprintf (il->instance, sizeof (il->instance),
        "%llu", val.counter);
    }
 -  il->instance[sizeof (il->instance) - 1] = '\0';
  
    /* TODO: Debugging output */
  
@@@ -943,7 -907,8 +943,7 @@@ static int csnmp_dispatch_table (host_d
      return (-1);
    }
  
 -  strncpy (vl.host, host->name, sizeof (vl.host));
 -  vl.host[sizeof (vl.host) - 1] = '\0';
 +  sstrncpy (vl.host, host->name, sizeof (vl.host));
    sstrncpy (vl.plugin, "snmp", sizeof (vl.plugin));
  
    vl.interval = host->interval;
        || (instance_list_ptr->subid == value_table_ptr[0]->subid));
  #endif
  
 +    sstrncpy (vl.type, data->type, sizeof (vl.type));
 +
      {
        char temp[DATA_MAX_NAME_LEN];
  
        if (instance_list_ptr == NULL)
 -      snprintf (temp, sizeof (temp), "%u",
 -          (uint32_t) subid);
 +      ssnprintf (temp, sizeof (temp), "%u", (uint32_t) subid);
        else
 -      strncpy (temp, instance_list_ptr->instance,
 -          sizeof (temp));
 -      temp[sizeof (temp) - 1] = '\0';
 +      sstrncpy (temp, instance_list_ptr->instance, sizeof (temp));
  
        if (data->instance_prefix == NULL)
 -      strncpy (vl.type_instance, temp, sizeof (vl.type_instance));
 +      sstrncpy (vl.type_instance, temp, sizeof (vl.type_instance));
        else
 -      snprintf (vl.type_instance, sizeof (vl.type_instance), "%s%s",
 +      ssnprintf (vl.type_instance, sizeof (vl.type_instance), "%s%s",
            data->instance_prefix, temp);
 -      vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
      }
  
      for (i = 0; i < data->values_len; i++)
        vl.values[i] = value_table_ptr[i]->value;
  
      /* If we get here `vl.type_instance' and all `vl.values' have been set */
 -    plugin_dispatch_values (data->type, &vl);
 +    plugin_dispatch_values (&vl);
  
      subid++;
    } /* while (have_more != 0) */
@@@ -1153,10 -1120,6 +1153,6 @@@ static int csnmp_read_table (host_defin
      vb = res->variables;
      if (vb == NULL)
      {
-       if (res != NULL)
-       snmp_free_pdu (res);
-       res = NULL;
        status = -1;
        break;
      }
       * subtree */
      if (csnmp_check_res_left_subtree (host, data, res) != 0)
      {
-       if (res != NULL)
-       snmp_free_pdu (res);
-       res = NULL;
+       status = 0;
        break;
      }
  
          (vb != NULL) && (vb->next_variable != NULL);
          vb = vb->next_variable)
        /* do nothing */;
-       if (vb == NULL)
-       {
-       status = -1;
-       break;
-       }
+       assert (vb != NULL);
  
        /* Copy OID to oid_list[data->values_len] */
        memcpy (oid_list[data->values_len].oid, vb->name,
      res = NULL;
    } /* while (status == 0) */
  
+   if (res != NULL)
+     snmp_free_pdu (res);
+   res = NULL;
    if (status == 0)
      csnmp_dispatch_table (host, data, instance_list, value_table);
  
@@@ -1332,10 -1292,11 +1325,10 @@@ static int csnmp_read_value (host_defin
        vl.values[i].gauge = NAN;
    }
  
 -  strncpy (vl.host, host->name, sizeof (vl.host));
 -  vl.host[sizeof (vl.host) - 1] = '\0';
 +  sstrncpy (vl.host, host->name, sizeof (vl.host));
    sstrncpy (vl.plugin, "snmp", sizeof (vl.plugin));
 -  strncpy (vl.type_instance, data->instance.string, sizeof (vl.type_instance));
 -  vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
 +  sstrncpy (vl.type, data->type, sizeof (vl.type));
 +  sstrncpy (vl.type_instance, data->instance.string, sizeof (vl.type_instance));
  
    vl.interval = host->interval;
  
      snmp_free_pdu (res);
    res = NULL;
  
 -  DEBUG ("snmp plugin: -> plugin_dispatch_values (%s, &vl);", data->type);
 -  plugin_dispatch_values (data->type, &vl);
 +  DEBUG ("snmp plugin: -> plugin_dispatch_values (&vl);");
 +  plugin_dispatch_values (&vl);
    sfree (vl.values);
  
    return (0);
diff --combined src/swap.c
@@@ -56,10 -56,10 +56,10 @@@ static kstat_t *ksp
  /* No global variables */
  /* #endif defined(VM_SWAPUSAGE) */
  
- #elif HAVE_LIBKVM
+ #elif HAVE_LIBKVM_GETSWAPINFO
  static kvm_t *kvm_obj = NULL;
  int kvm_pagesize;
- /* #endif HAVE_LIBKVM */
+ /* #endif HAVE_LIBKVM_GETSWAPINFO */
  
  #elif HAVE_LIBSTATGRAB
  /* No global variables */
@@@ -86,7 -86,7 +86,7 @@@ static int swap_init (void
        /* No init stuff */
  /* #endif defined(VM_SWAPUSAGE) */
  
- #elif HAVE_LIBKVM
+ #elif HAVE_LIBKVM_GETSWAPINFO
        if (kvm_obj != NULL)
        {
                kvm_close (kvm_obj);
                ERROR ("swap plugin: kvm_open failed.");
                return (-1);
        }
- /* #endif HAVE_LIBKVM */
+ /* #endif HAVE_LIBKVM_GETSWAPINFO */
  
  #elif HAVE_LIBSTATGRAB
        /* No init stuff */
@@@ -126,10 -126,9 +126,10 @@@ static void swap_submit (const char *ty
        vl.time = time (NULL);
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "swap", sizeof (vl.plugin));
 -      strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
 +      sstrncpy (vl.type, "swap", sizeof (vl.type));
 +      sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
  
 -      plugin_dispatch_values ("swap", &vl);
 +      plugin_dispatch_values (&vl);
  } /* void swap_submit */
  
  static int swap_read (void)
        swap_submit ("free", sw_usage.xsu_avail);
  /* #endif VM_SWAPUSAGE */
  
- #elif HAVE_LIBKVM
+ #elif HAVE_LIBKVM_GETSWAPINFO
        struct kvm_swap data_s;
        int             status;
  
  
        swap_submit ("used", used);
        swap_submit ("free", free);
- /* #endif HAVE_LIBKVM */
+ /* #endif HAVE_LIBKVM_GETSWAPINFO */
  
  #elif HAVE_LIBSTATGRAB
        sg_swap_stats *swap;
diff --combined src/tcpconns.c
@@@ -137,36 -137,39 +137,36 @@@ static void conn_submit_port_entry (por
    vl.time = time (NULL);
    sstrncpy (vl.host, hostname_g, sizeof (vl.host));
    sstrncpy (vl.plugin, "tcpconns", sizeof (vl.plugin));
 +  sstrncpy (vl.type, "tcp_connections", sizeof (vl.type));
  
    if (((port_collect_listening != 0) && (pe->flags & PORT_IS_LISTENING))
        || (pe->flags & PORT_COLLECT_LOCAL))
    {
 -    snprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
 +    ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
-       "%hu-local", pe->port);
+       "%"PRIu16"-local", pe->port);
 -    vl.plugin_instance[sizeof (vl.plugin_instance) - 1] = '\0';
  
      for (i = 1; i <= TCP_STATE_MAX; i++)
      {
        vl.values[0].gauge = pe->count_local[i];
  
 -      strncpy (vl.type_instance, tcp_state[i], sizeof (vl.type_instance));
 -      vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
 +      sstrncpy (vl.type_instance, tcp_state[i], sizeof (vl.type_instance));
  
 -      plugin_dispatch_values ("tcp_connections", &vl);
 +      plugin_dispatch_values (&vl);
      }
    }
  
    if (pe->flags & PORT_COLLECT_REMOTE)
    {
 -    snprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
 +    ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
-       "%hu-remote", pe->port);
+       "%"PRIu16"-remote", pe->port);
 -    vl.plugin_instance[sizeof (vl.plugin_instance) - 1] = '\0';
  
      for (i = 1; i <= TCP_STATE_MAX; i++)
      {
        vl.values[0].gauge = pe->count_remote[i];
  
 -      strncpy (vl.type_instance, tcp_state[i], sizeof (vl.type_instance));
 -      vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
 +      sstrncpy (vl.type_instance, tcp_state[i], sizeof (vl.type_instance));
  
 -      plugin_dispatch_values ("tcp_connections", &vl);
 +      plugin_dispatch_values (&vl);
      }
    }
  } /* void conn_submit */
@@@ -224,7 -227,7 +224,7 @@@ static void conn_reset_port_entry (void
        port_entry_t *next = pe->next;
  
        DEBUG ("tcpconns plugin: Removing temporary entry "
-         "for listening port %hu", pe->port);
+         "for listening port %"PRIu16, pe->port);
  
        if (prev == NULL)
        port_list_head = next;
@@@ -255,8 -258,8 +255,8 @@@ static int conn_handle_ports (uint16_t 
  #endif
       )
    {
-     NOTICE ("tcpconns plugin: Ignoring connection with unknown state 0x%02x.",
-       state);
+     NOTICE ("tcpconns plugin: Ignoring connection with "
+       "unknown state 0x%02"PRIx8".", state);
      return (-1);
    }
  
        pe->flags |= PORT_IS_LISTENING;
    }
  
-   DEBUG ("tcpconns plugin: Connection %hu <-> %hu (%s)",
+   DEBUG ("tcpconns plugin: Connection %"PRIu16" <-> %"PRIu16" (%s)",
        port_local, port_remote, tcp_state[state]);
  
    pe = conn_get_port_entry (port_local, 0 /* no create */);