Merge remote-tracking branch 'github/pr/2276'
authorFlorian Forster <octo@collectd.org>
Wed, 19 Jul 2017 05:54:49 +0000 (07:54 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 19 Jul 2017 05:54:49 +0000 (07:54 +0200)
1  2 
Makefile.am
README
configure.ac
contrib/systemd.collectd.service
src/collectd.conf.in
src/collectd.conf.pod

diff --combined Makefile.am
@@@ -119,10 -119,7 +119,10 @@@ noinst_LTLIBRARIES = 
        liblookup.la \
        libmetadata.la \
        libmount.la \
 -      liboconfig.la \
 +      liboconfig.la
 +
 +
 +check_LTLIBRARIES = \
        libplugin_mock.la
  
  
@@@ -694,15 -691,6 +694,15 @@@ curl_json_la_CFLAGS = $(AM_CFLAGS) $(BU
  curl_json_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBYAJL_CPPFLAGS)
  curl_json_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBYAJL_LDFLAGS)
  curl_json_la_LIBADD = $(BUILD_WITH_LIBCURL_LIBS) $(BUILD_WITH_LIBYAJL_LIBS)
 +
 +test_plugin_curl_json_SOURCES = src/curl_json_test.c \
 +                              src/utils_curl_stats.c \
 +                              src/daemon/configfile.c \
 +                              src/daemon/types_list.c
 +test_plugin_curl_json_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBYAJL_CPPFLAGS)
 +test_plugin_curl_json_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBYAJL_LDFLAGS)
 +test_plugin_curl_json_LDADD = libavltree.la liboconfig.la libplugin_mock.la $(BUILD_WITH_LIBCURL_LIBS) $(BUILD_WITH_LIBYAJL_LIBS)
 +check_PROGRAMS += test_plugin_curl_json
  endif
  
  if BUILD_PLUGIN_CURL_XML
@@@ -888,6 -876,14 +888,14 @@@ hugepages_la_SOURCES = src/hugepages.
  hugepages_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  endif
  
+ if BUILD_PLUGIN_INTEL_PMU
+ pkglib_LTLIBRARIES += intel_pmu.la
+ intel_pmu_la_SOURCES = src/intel_pmu.c
+ intel_pmu_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBJEVENTS_CPPFLAGS)
+ intel_pmu_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBJEVENTS_LDFLAGS)
+ intel_pmu_la_LIBADD = $(BUILD_WITH_LIBJEVENTS_LIBS)
+ endif
  if BUILD_PLUGIN_INTEL_RDT
  pkglib_LTLIBRARIES += intel_rdt.la
  intel_rdt_la_SOURCES = src/intel_rdt.c
@@@ -943,6 -939,10 +951,6 @@@ endi
  if BUILD_PLUGIN_IPVS
  pkglib_LTLIBRARIES += ipvs.la
  ipvs_la_SOURCES = src/ipvs.c
 -ipvs_la_CFLAGS = $(AM_CFLAGS)
 -if IP_VS_H_NEEDS_KERNEL_CFLAGS
 -ipvs_la_CFLAGS += $(KERNEL_CFLAGS)
 -endif
  ipvs_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  endif
  
@@@ -1388,6 -1388,9 +1396,6 @@@ python_la_SOURCES = 
        src/pyvalues.c \
        src/cpython.h
  python_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBPYTHON_CPPFLAGS)
 -if COMPILER_IS_GCC
 -python_la_CPPFLAGS += -fno-strict-aliasing -Wno-strict-aliasing
 -endif
  python_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(LIBPYTHON_LDFLAGS)
  endif
  
@@@ -1486,14 -1489,6 +1494,14 @@@ snmp_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(B
  snmp_la_LIBADD = $(BUILD_WITH_LIBNETSNMP_LIBS)
  endif
  
 +if BUILD_PLUGIN_SNMP_AGENT
 +pkglib_LTLIBRARIES += snmp_agent.la
 +snmp_agent_la_SOURCES = src/snmp_agent.c
 +snmp_agent_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBNETSNMPAGENT_CPPFLAGS)
 +snmp_agent_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBNETSNMPAGENT_LDFLAGS)
 +snmp_agent_la_LIBADD = $(BUILD_WITH_LIBNETSNMPAGENT_LIBS)
 +endif
 +
  if BUILD_PLUGIN_STATSD
  pkglib_LTLIBRARIES += statsd.la
  statsd_la_SOURCES = src/statsd.c
@@@ -2015,10 -2010,10 +2023,10 @@@ dist_noinst_JAVA = 
        bindings/java/org/collectd/java/GenericJMXConfValue.java \
        bindings/java/org/collectd/java/JMXMemory.java
  
 -collectd-api.jar: classnoinst.stamp
 +collectd-api.jar: $(JAVA_TIMESTAMP_FILE)
        $(JAR) cf $(JARFLAGS) $@ org/collectd/api/*.class
  
 -generic-jmx.jar: classnoinst.stamp
 +generic-jmx.jar: $(JAVA_TIMESTAMP_FILE)
        $(JAR) cf $(JARFLAGS) $@ org/collectd/java/*.class
  
  jar_DATA = collectd-api.jar generic-jmx.jar
diff --combined README
--- 1/README
--- 2/README
+++ b/README
@@@ -140,6 -140,11 +140,11 @@@ Feature
        hugepages can be found here:
        https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt.
  
+     - intel_pmu
+       The intel_pmu plugin reads performance counters provided by the Linux
+       kernel perf interface. The plugin uses jevents library to resolve named
+       events to perf events and access perf interface.
      - intel_rdt
        The intel_rdt plugin collects information provided by monitoring features
        of Intel Resource Director Technology (Intel(R) RDT) like Cache Monitoring
  
      - netapp
        Plugin to query performance values from a NetApp storage system using the
-       “Manage ONTAP” SDK provided by NetApp.
+       “Manage ONTAP” SDK provided by NetApp.
  
      - netlink
        Very detailed Linux network interface and routing statistics. You can get
        updates to the files and write a bunch of updates at once, which lessens
        system load a lot.
  
 +    - snmp_agent
 +      Receives and handles queries from SNMP master agent and returns the data
 +      collected by read plugins. Handles requests only for OIDs specified in
 +      configuration file. To handle SNMP queries the plugin gets data from
 +      collectd and translates requested values from collectd's internal format
 +      to SNMP format.
 +
      - unixsock
        One can query the values from the unixsock plugin whenever they're
        needed. Please read collectd-unixsock(5) for a description on how that's
@@@ -786,6 -784,13 +791,13 @@@ Prerequisite
      For querying iptables counters.
      <http://netfilter.org/>
  
+   * libjevents (optional)
+     The jevents library is used by the `intel_pmu' plugin to access the Linux
+     kernel perf interface.
+     Note: the library should be build with -fPIC flag to be linked with
+     intel_pmu shared object correctly.
+     <https://github.com/andikleen/pmu-tools>
    * libjvm (optional)
      Library that encapsulates the `Java Virtual Machine' (JVM). This library is
      used by the `java' plugin to execute Java bytecode.
      This library is part of the “Manage ONTAP SDK” published by NetApp.
  
    * libnetsnmp (optional)
 -    For the `snmp' plugin.
 +    For the `snmp' and 'snmp_agent' plugins.
 +    <http://www.net-snmp.org/>
 +
 +  * libnetsnmpagent (optional)
 +    Required for the 'snmp_agent' plugin.
      <http://www.net-snmp.org/>
  
    * libnotify (optional)
diff --combined configure.ac
@@@ -27,9 -27,6 +27,9 @@@ AC_SYS_LARGEFIL
  AC_PROG_CC_C99([],
    [AC_MSG_ERROR([No compiler found that supports C99])]
  )
 +
 +AX_COMPILER_VENDOR
 +
  AC_PROG_CXX
  AC_PROG_CPP
  AC_PROG_EGREP
@@@ -37,6 -34,7 +37,6 @@@ AC_PROG_INSTAL
  AC_PROG_LN_S
  AC_PROG_MAKE_SET
  AM_PROG_CC_C_O
 -AM_CONDITIONAL([COMPILER_IS_GCC], [test "x$GCC" = "xyes"])
  
  AC_PROG_LEX
  AC_PROG_YACC
@@@ -62,9 -60,9 +62,9 @@@ if test "x$collectd_cv_prog_bison" = "x
    AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/src/liboconfig/parser.c. Please install bison])
  fi
  
 -AS_IF([test "x$lt_cv_dlopen" = "xno"],
 -  [AC_MSG_ERROR([Your system does not support dlopen])]
 -)
 +if test "x$lt_cv_dlopen" = "xno"; then
 +  AC_MSG_ERROR([Your system does not support dlopen])
 +fi
  
  AC_SUBST([DLOPEN_LIBS], [$lt_cv_dlopen_libs])
  
@@@ -112,6 -110,15 +112,6 @@@ AM_CONDITIONAL([BUILD_LINUX], [test "x$
  AM_CONDITIONAL([BUILD_OPENBSD], [test "x$ac_system" = "xOpenBSD"])
  AM_CONDITIONAL([BUILD_SOLARIS], [test "x$ac_system" = "xSolaris"])
  
 -if test "x$ac_system" = "xLinux"; then
 -  AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
 -  if test "x$KERNEL_DIR" = "x"; then
 -    KERNEL_DIR="/lib/modules/`uname -r`/source"
 -  fi
 -  KERNEL_CFLAGS="-I$KERNEL_DIR/include"
 -  AC_SUBST([KERNEL_CFLAGS])
 -fi
 -
  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.])
@@@ -352,7 -359,7 +352,7 @@@ AC_CHECK_HEADERS([netinet/udp.h], [], [
  AC_CHECK_HEADERS([sys/dkstat.h])
  if test "x$ac_system" = "xDarwin"; then
    AC_CHECK_HEADERS(
 -    [[ \
 +    [ \
        mach/mach_init.h \
        mach/host_priv.h \
        mach/mach_error.h \
        IOKit/ps/IOPSKeys.h \
        IOKit/IOBSD.h \
        IOKit/storage/IOBlockStorageDriver.h
 -    ]]
 +    ]
    )
  
    # For the battery plugin
@@@ -452,7 -459,7 +452,7 @@@ if test "x$ac_system" = "xLinux"; the
        #endif
      ]]
    )
 -  
 +
    AC_CHECK_HEADERS([linux/inet_diag.h], [], [],
      [[
        #if HAVE_SYS_TYPES_H
        #endif
      ]]
    )
 -  
 +
    AC_CHECK_HEADERS([linux/netdevice.h], [], [],
      [[
        #if HAVE_SYS_TYPES_H
        #endif
      ]]
    )
 -  
 +
    # For ethstat module
    AC_CHECK_HEADERS([linux/sockios.h],
      [have_linux_sockios_h="yes"],
        #endif
      ]]
    )
 -  
 +
    AC_CHECK_HEADERS([linux/ethtool.h],
      [have_linux_ethtool_h="yes"],
      [have_linux_ethtool_h="no"],
    )
  
    # For ipvs module
 -  AC_CHECK_HEADERS([linux/ip_vs.h], [have_linux_ip_vs_h="yes"], [have_linux_ip_vs="no"])
 -  AC_CHECK_HEADERS([net/ip_vs.h], [have_net_ip_vs_h="yes"], [have_net_ip_vs_h="no"])
 -  AC_CHECK_HEADERS([ip_vs.h], [have_ip_vs_h="yes"], [have_ip_vs_h="no"])
 -
 -  ip_vs_h_needs_kernel_cflags="no"
 -  
 -  if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"; then
 -    SAVE_CFLAGS="$CFLAGS"
 -    CFLAGS="$CFLAGS $KERNEL_CFLAGS"
 -    
 -    AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
 -    
 -    AC_CHECK_HEADERS([linux/ip_vs.h], [have_linux_ip_vs_h="yes"])
 -    AC_CHECK_HEADERS([net/ip_vs.h], [have_net_ip_vs_h="yes"])
 -    AC_CHECK_HEADERS([ip_vs.h], [have_ip_vs_h="yes"])
 -    
 -    if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"; then
 -      ip_vs_h_needs_kernel_cflags="yes"
 -    fi
 -    
 -    CFLAGS="$SAVE_CFLAGS"
 -  fi
 +  AC_CHECK_HEADERS_ONCE([linux/ip_vs.h])
  
    # For the email plugin
    AC_CHECK_HEADERS([linux/un.h], [], [],
      [have_asm_msrindex_h="yes"],
      [have_asm_msrindex_h="no"]
    )
 -  
 +
    if test "x$have_asm_msrindex_h" = "xyes"; then
      AC_CACHE_CHECK([whether asm/msr-index.h has MSR_PKG_C10_RESIDENCY],
        [c_cv_have_usable_asm_msrindex_h],
        ]
      )
    fi
 -  
 +
    AC_CHECK_HEADERS([cpuid.h],
      [have_cpuid_h="yes"],
      [have_cpuid_h="no (cpuid.h not found)"]
    )
 -  
 +
    AC_CHECK_HEADERS([sys/capability.h],
      [have_capability="yes"],
      [have_capability="no (<sys/capability.h> not found)"]
@@@ -580,6 -608,7 +580,6 @@@ els
    have_linux_wireless_h="no"
  fi
  
 -AM_CONDITIONAL([IP_VS_H_NEEDS_KERNEL_CFLAGS], [test "x$ip_vs_h_needs_kernel_cflags" = "xyes"])
  AM_CONDITIONAL([BUILD_WITH_CAPABILITY], [test "x$have_capability" = "xyes"])
  
  # For the swap module
@@@ -1370,8 -1399,8 +1370,8 @@@ if test "x$fp_layout_type" = "xunknown"
                    && (c[2] == 0xc0) && (c[3] == 0xc7)
                    && (c[4] == 0x43) && (c[5] == 0x2b)
                    && (c[6] == 0x1f) && (c[7] == 0x5b))
 -                return (0);
 -              return (1);
 +                return 0;
 +              return 1;
              ]]
            )
          ],
@@@ -1414,19 -1443,19 +1414,19 @@@ if test "x$fp_layout_type" = "xunknown"
                uint64_t i1;
                uint8_t c[8];
                double d;
 -              
 +
                d = 8.642135e130;
                memcpy ((void *) &i0, (void *) &d, 8);
 -              
 +
                i1 = endianflip (i0);
                memcpy ((void *) c, (void *) &i1, 8);
 -              
 +
                if ((c[0] == 0x2f) && (c[1] == 0x25)
                    && (c[2] == 0xc0) && (c[3] == 0xc7)
                    && (c[4] == 0x43) && (c[5] == 0x2b)
                    && (c[6] == 0x1f) && (c[7] == 0x5b))
 -                return (0);
 -              return (1);
 +                return 0;
 +              return 1;
              ]]
            )
          ],
@@@ -1463,19 -1492,19 +1463,19 @@@ if test "x$fp_layout_type" = "xunknown"
                uint64_t i1;
                uint8_t c[8];
                double d;
 -              
 +
                d = 8.642135e130;
                memcpy ((void *) &i0, (void *) &d, 8);
 -              
 +
                i1 = intswap (i0);
                memcpy ((void *) c, (void *) &i1, 8);
 -              
 +
                if ((c[0] == 0x2f) && (c[1] == 0x25)
                    && (c[2] == 0xc0) && (c[3] == 0xc7)
                    && (c[4] == 0x43) && (c[5] == 0x2b)
                    && (c[6] == 0x1f) && (c[7] == 0x5b))
 -                return (0);
 -              return (1);
 +                return 0;
 +              return 1;
              ]]
            )
          ],
@@@ -2347,57 -2376,6 +2347,57 @@@ AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS
  AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
  # }}}
  
 +# --with-libdpdk {{{
 +AC_ARG_VAR([LIBDPDK_CPPFLAGS], [Preprocessor flags for libdpdk])
 +AC_ARG_VAR([LIBDPDK_LDFLAGS], [Linker flags for libdpdk])
 +
 +AC_ARG_WITH([libdpdk],
 +  [AS_HELP_STRING([--without-libdpdk], [Disable libdpdk.])],
 +  [with_libdpdk="$withval"],
 +  [with_libdpdk="yes"]
 +)
 +
 +if test "x$with_libdpdk" != "xno"; then
 +  if test "x$LIBDPDK_CPPFLAGS" = "x"; then
 +    LIBDPDK_CPPFLAGS="-I/usr/include/dpdk"
 +  fi
 +  SAVE_CPPFLAGS="$CPPFLAGS"
 +  CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS"
 +  AC_CHECK_HEADERS([rte_config.h],
 +    [
 +      with_libdpdk="yes"
 +      AC_PREPROC_IFELSE(
 +        [
 +          AC_LANG_SOURCE(
 +            [[
 +              #include <rte_version.h>
 +              #if RTE_VERSION < RTE_VERSION_NUM(16,7,0,0)
 +              #error "required DPDK >= 16.07"
 +              #endif
 +            ]]
 +          )
 +        ],
 +        [dpdk_keepalive="yes"],
 +        [dpdk_keepalive="no (DPDK version < 16.07)"]
 +      )
 +    ],
 +    [with_libdpdk="no (rte_config.h not found)"]
 +  )
 +  CPPFLAGS="$SAVE_CPPFLAGS"
 +fi
 +
 +if test "x$with_libdpdk" = "xyes"; then
 +  SAVE_LDFLAGS="$LDFLAGS"
 +  LDFLAGS="$LIBDPDK_LDFLAGS $LDFLAGS"
 +  AC_CHECK_LIB([dpdk], [rte_eal_init],
 +    [with_libdpdk="yes"],
 +    [with_libdpdk="no (symbol 'rte_eal_init' not found)"]
 +  )
 +  LDFLAGS="$SAVE_LDFLAGS"
 +fi
 +
 +# }}}
 +
  # --with-libesmtp {{{
  AC_ARG_WITH([libesmtp],
    [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
@@@ -2810,6 -2788,56 +2810,6 @@@ AC_SUBST([BUILD_WITH_LIBIPTC_CPPFLAGS]
  AC_SUBST([BUILD_WITH_LIBIPTC_LDFLAGS])
  # }}}
  
 -# --with-libdpdk {{{
 -AC_ARG_VAR([LIBDPDK_CPPFLAGS], [Preprocessor flags for libdpdk])
 -AC_ARG_VAR([LIBDPDK_LDFLAGS], [Linker flags for libdpdk])
 -
 -AC_ARG_WITH([libdpdk], [AS_HELP_STRING([--without-libdpdk], [Disable libdpdk.])])
 -
 -if test "x$with_libdpdk" != "xno"; then
 -  if test "x$LIBDPDK_CPPFLAGS" = "x"; then
 -    LIBDPDK_CPPFLAGS="-I/usr/include/dpdk"
 -  fi
 -  SAVE_CPPFLAGS="$CPPFLAGS"
 -  CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS"
 -  AC_CHECK_HEADERS([rte_config.h],
 -    [
 -      with_libdpdk="yes"
 -      AC_COMPILE_IFELSE(
 -        [
 -          AC_LANG_PROGRAM(
 -            [[
 -              #include <rte_version.h>
 -              #if RTE_VERSION < RTE_VERSION_NUM(16,7,0,0)
 -              #error "required DPDK >= 16.07"
 -              #endif
 -            ]],
 -            [[
 -              return 0;
 -            ]]
 -          )
 -        ],
 -        [dpdk_keepalive="yes"],
 -        [dpdk_keepalive="no (DPDK version < 16.07)"]
 -      )
 -    ],
 -    [with_libdpdk="no (rte_config.h not found)"]
 -  )
 -  CPPFLAGS="$SAVE_CPPFLAGS"
 -fi
 -
 -if test "x$with_libdpdk" = "xyes"; then
 -  SAVE_LDFLAGS="$LDFLAGS"
 -  LDFLAGS="$LIBDPDK_LDFLAGS $LDFLAGS"
 -  AC_CHECK_LIB([dpdk], [rte_eal_init],
 -    [with_libdpdk="yes"],
 -    [with_libdpdk="no (symbol 'rte_eal_init' not found)"]
 -  )
 -  LDFLAGS="$SAVE_LDFLAGS"
 -fi
 -
 -# }}}
 -
  # --with-java {{{
  with_java_home="$JAVA_HOME"
  if test "x$with_java_home" = "x"; then
@@@ -2833,9 -2861,6 +2833,9 @@@ AC_ARG_WITH([java]
    [with_java="yes"]
  )
  
 +AX_COMPARE_VERSION([$am__api_version],[lt],[1.12],
 +  [JAVA_TIMESTAMP_FILE="classdist_noinst.stamp"],
 +  [JAVA_TIMESTAMP_FILE="classnoinst.stamp"])
  if test "x$with_java" = "xyes"; then
    if test -d "$with_java_home"; then
      AC_MSG_CHECKING([for jni.h])
@@@ -2972,7 -2997,6 +2972,7 @@@ AC_SUBST([JAVA_CPPFLAGS]
  AC_SUBST([JAVA_CFLAGS])
  AC_SUBST([JAVA_LDFLAGS])
  AC_SUBST([JAVA_LIBS])
 +AC_SUBST([JAVA_TIMESTAMP_FILE])
  AM_CONDITIONAL([BUILD_WITH_JAVA], [test "x$with_java" = "xyes"])
  # }}}
  
@@@ -3629,7 -3653,7 +3629,7 @@@ if test "x$with_libmnl" = "xyes"; the
          ]],
          [[
            int retval = TCA_STATS2;
 -          return (retval);
 +          return retval;
          ]]
        )
      ],
          ]],
          [[
            int retval = TCA_STATS;
 -          return (retval);
 +          return retval;
          ]]
        )
      ],
@@@ -3739,131 -3763,54 +3739,131 @@@ AC_SUBST([LIBNETAPP_LIBS]
  # }}}
  
  # --with-libnetsnmp {{{
 -AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
 -[
 -      if test "x$withval" = "xno"
 -      then
 -              with_libnetsnmp="no"
 -      else if test "x$withval" = "xyes"
 -      then
 -              with_libnetsnmp="yes"
 -      else
 -              with_libnetsnmp_cppflags="-I$withval/include"
 -              with_libnetsnmp_ldflags="-I$withval/lib"
 -              with_libnetsnmp="yes"
 -      fi; fi
 -],
 -[with_libnetsnmp="yes"])
 -if test "x$with_libnetsnmp" = "xyes"
 -then
 -      SAVE_CPPFLAGS="$CPPFLAGS"
 -      CPPFLAGS="$CPPFLAGS $with_libnetsnmp_cppflags"
 +AC_ARG_WITH([libnetsnmp],
 +  [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to libnetsnmp.])],
 +  [
 +    if test "x$withval" = "xno"; then
 +     with_libnetsnmp="no"
 +    else if test "x$withval" = "xyes"; then
 +     with_libnetsnmp="yes"
 +    else
 +      with_libnetsnmp_cppflags="-I$withval/include"
 +      with_libnetsnmp_ldflags="-I$withval/lib"
 +      with_libnetsnmp="yes"
 +    fi; fi
 +  ],
 +  [with_libnetsnmp="yes"]
 +)
  
 -    AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],
 -      [with_libnetsnmp="yes"],
 -      [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]
 -    )
 +if test "x$with_libnetsnmp" = "xyes"; then
 +  SAVE_CPPFLAGS="$CPPFLAGS"
 +  CPPFLAGS="$CPPFLAGS $with_libnetsnmp_cppflags"
  
 -      CPPFLAGS="$SAVE_CPPFLAGS"
 +  AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],
 +    [with_libnetsnmp="yes"],
 +    [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]
 +  )
 +
 +  AC_CHECK_HEADERS([net-snmp/net-snmp-includes.h],
 +    [with_libnetsnmp="yes"],
 +    [with_libnetsnmp="no (net-snmp/net-snmp-includes.h not found)"],
 +    [[
 +      #if HAVE_NET_SNMP_NET_SNMP_CONFIG_H
 +      # include <net-snmp/net-snmp-config.h>
 +      #endif
 +    ]]
 +  )
 +
 +  CPPFLAGS="$SAVE_CPPFLAGS"
  fi
 -if test "x$with_libnetsnmp" = "xyes"
 -then
 -      SAVE_LDFLAGS="$LDFLAGS"
 -      LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags"
  
 -      AC_CHECK_LIB(netsnmp, init_snmp,
 -              [with_libnetsnmp="yes"],
 -              [with_libnetsnmp="no (libnetsnmp not found)"],
 -              [$with_snmp_libs])
 +if test "x$with_libnetsnmp" = "xyes"; then
 +  SAVE_LDFLAGS="$LDFLAGS"
 +  LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags"
  
 -      LDFLAGS="$SAVE_LDFLAGS"
 +  AC_CHECK_LIB([netsnmp], [init_snmp],
 +    [with_libnetsmp="yes"],
 +    [with_libnetsnmp="no (libnetsnmp not found)"]
 +  )
 +
 +  LDFLAGS="$SAVE_LDFLAGS"
  fi
 -if test "x$with_libnetsnmp" = "xyes"
 -then
 -      BUILD_WITH_LIBNETSNMP_CPPFLAGS="$with_libnetsnmp_cppflags"
 -      BUILD_WITH_LIBNETSNMP_LDFLAGS="$with_libnetsnmp_ldflags"
 -      BUILD_WITH_LIBNETSNMP_LIBS="-lnetsnmp"
 +
 +if test "x$with_libnetsnmp" = "xyes"; then
 +  BUILD_WITH_LIBNETSNMP_CPPFLAGS="$with_libnetsnmp_cppflags"
 +  BUILD_WITH_LIBNETSNMP_LDFLAGS="$with_libnetsnmp_ldflags"
 +  BUILD_WITH_LIBNETSNMP_LIBS="-lnetsnmp"
 +fi
 +
 +AC_SUBST([BUILD_WITH_LIBNETSNMP_CPPFLAGS])
 +AC_SUBST([BUILD_WITH_LIBNETSNMP_LDFLAGS])
 +AC_SUBST([BUILD_WITH_LIBNETSNMP_LIBS])
 +# }}}
 +
 +# --with-libnetsmpagent {{{
 +AC_ARG_WITH([libnetsnmpagent],
 +  [AS_HELP_STRING([--with-libnetsnmpagent@<:@=PREFIX@:>@], [Path to libnetsnmpagent.])],
 +  [
 +    if test "x$withval" = "xno"; then
 +      with_libnetsnmpagent="no"
 +    else if test "x$withval" = "xyes"; then
 +      with_libnetsnmpagent="yes"
 +    else
 +      with_libnetsnmpagent_cppflags="-I$withval/include"
 +      with_libnetsnmpagent_ldflags="-I$withval/lib"
 +      with_libnetsnmpagent="yes"
 +    fi; fi
 +  ],
 +  [with_libnetsnmpagent="yes"]
 +)
 +
 +if test "x$with_libnetsnmpagent" = "xyes"; then
 +  SAVE_CPPFLAGS="$CPPFLAGS"
 +  CPPFLAGS="$CPPFLAGS $with_libnetsnmpagent_cppflags"
 +
 +  AC_CHECK_HEADERS([net-snmp/agent/net-snmp-agent-includes.h],
 +    [],
 +    [with_libnetsnmpagent="no (net-snmp/agent/net-snmp-agent-includes.h not found)"],
 +    [[
 +      #if HAVE_NET_SNMP_NET_SNMP_CONFIG_H
 +      # include <net-snmp/net-snmp-config.h>
 +      #endif
 +      #if HAVE_NET_SNMP_NET_SNMP_INCLUDES_H
 +      # include <net-snmp/net-snmp-includes.h>
 +      #endif
 +    ]]
 +  )
 +
 +  CPPFLAGS="$SAVE_CPPFLAGS"
 +fi
 +
 +if test "x$with_libnetsnmpagent" = "xyes"; then
 +  SAVE_LDFLAGS="$LDFLAGS"
 +  LDFLAGS="$LDFLAGS $with_libnetsnmpagent_ldflags"
 +
 +  # older versions of libnetsnmpagent fail to link
 +  # against the helpers library, so do that explicitly
 +  AC_CHECK_LIB([netsnmphelpers], [netsnmp_init_helpers],
 +    [libnetsnmphelpers="-lnetsnmphelpers"],
 +    [libnetsnmphelpers=""]
 +  )
 +
 +  AC_CHECK_LIB([netsnmpagent], [init_agent],
 +    [with_libnetsnmpagent="yes"],
 +    [with_libnetsnmpagent="no (libnetsnmpagent not found)"],
 +    [$libnetsnmphelpers]
 +  )
 +
 +  LDFLAGS="$SAVE_LDFLAGS"
 +fi
 +
 +if test "x$with_libnetsnmpagent" = "xyes"; then
 +  BUILD_WITH_LIBNETSNMPAGENT_LIBS="-lnetsnmpagent $libnetsnmphelpers"
  fi
 -AC_SUBST(BUILD_WITH_LIBNETSNMP_CPPFLAGS)
 -AC_SUBST(BUILD_WITH_LIBNETSNMP_LDFLAGS)
 -AC_SUBST(BUILD_WITH_LIBNETSNMP_LIBS)
 +
 +AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_CPPFLAGS])
 +AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_LDFLAGS])
 +AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_LIBS])
  # }}}
  
  # --with-liboping {{{
@@@ -4359,76 -4306,107 +4359,119 @@@ AC_SUBST([BUILD_WITH_LIBPQ_LIBS]
  # }}}
  
  # --with-libpqos {{{
 -with_libpqos_cppflags=""
 -with_libpqos_ldflags=""
 -AC_ARG_WITH(libpqos, [AS_HELP_STRING([--with-libpqos@<:@=PREFIX@:>@], [Path to libpqos.])],
 -[
 -      if test "x$withval" != "xno" && test "x$withval" != "xyes"
 -      then
 -              with_libpqos_cppflags="-I$withval/include"
 -              with_libpqos_ldflags="-L$withval/lib"
 -              with_libpqos="yes"
 -      else
 -              with_libpqos="$withval"
 -      fi
 -],
 -[
 -      with_libpqos="yes"
 -])
 -if test "x$with_libpqos" = "xyes"
 -then
 -      SAVE_CPPFLAGS="$CPPFLAGS"
 -      CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
 +AC_ARG_WITH([libpqos],
 +  [AS_HELP_STRING([--with-libpqos@<:@=PREFIX@:>@], [Path to libpqos.])],
 +  [
 +    if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
 +      with_libpqos_cppflags="-I$withval/include"
 +      with_libpqos_ldflags="-L$withval/lib"
 +      with_libpqos="yes"
 +    else
 +      with_libpqos="$withval"
 +    fi
 +  ],
 +  [with_libpqos="yes"]
 +)
  
 -      AC_CHECK_HEADERS(pqos.h, [with_libpqos="yes"], [with_libpqos="no (pqos.h not found)"])
 +if test "x$with_libpqos" = "xyes"; then
 +  SAVE_CPPFLAGS="$CPPFLAGS"
 +  CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
  
 -      CPPFLAGS="$SAVE_CPPFLAGS"
 +  AC_CHECK_HEADERS([pqos.h],
 +    [with_libpqos="yes"],
 +    [with_libpqos="no (pqos.h not found)"]
 +  )
 +
 +  CPPFLAGS="$SAVE_CPPFLAGS"
  fi
 -if test "x$with_libpqos" = "xyes"
 -then
 -      SAVE_CPPFLAGS="$CPPFLAGS"
 -      SAVE_LDFLAGS="$LDFLAGS"
 -      CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
 -      LDFLAGS="$LDFLAGS $with_libpqos_ldflags"
  
 -      AC_CHECK_LIB(pqos, pqos_init, [with_libpqos="yes"], [with_libpqos="no (Can't find libpqos)"])
 +if test "x$with_libpqos" = "xyes"; then
 +  SAVE_LDFLAGS="$LDFLAGS"
 +  LDFLAGS="$LDFLAGS $with_libpqos_ldflags"
  
 -      CPPFLAGS="$SAVE_CPPFLAGS"
 -      LDFLAGS="$SAVE_LDFLAGS"
 +  AC_CHECK_LIB([pqos], [pqos_init],
 +    [with_libpqos="yes"],
 +    [with_libpqos="no (Can't find libpqos)"]
 +  )
 +
 +  LDFLAGS="$SAVE_LDFLAGS"
  fi
 -if test "x$with_libpqos" = "xyes"
 -then
 +
 +if test "x$with_libpqos" = "xyes"; then
    SAVE_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
 -  AC_RUN_IFELSE([AC_LANG_PROGRAM(
 -    [[#include <pqos.h>]],
 -    [[return !(PQOS_VERSION >= 106)]])],
 -    [with_libpqos="yes"], [with_libpqos="no (pqos library version 1.06 or higher is required)"])
 +  AC_PREPROC_IFELSE(
 +    [
 +      AC_LANG_SOURCE(
 +        [[
 +          #include <pqos.h>
 +          #if PQOS_VERSION < 106
 +          #error "required PQOS version >= 1.06"
 +          #endif
 +        ]]
 +      )
 +    ],
 +    [with_libpqos="yes"],
 +    [with_libpqos="no (pqos library version 1.06 or higher is required)"]
 +  )
 +
    CPPFLAGS="$SAVE_CPPFLAGS"
  fi
 -if test "x$with_libpqos" = "xyes"
 -then
 -      BUILD_WITH_LIBPQOS_CPPFLAGS="$with_libpqos_cppflags"
 -      BUILD_WITH_LIBPQOS_LDFLAGS="$with_libpqos_ldflags"
 -      BUILD_WITH_LIBPQOS_LIBS="-lpqos"
 -      AC_SUBST(BUILD_WITH_LIBPQOS_CPPFLAGS)
 -      AC_SUBST(BUILD_WITH_LIBPQOS_LDFLAGS)
 -      AC_SUBST(BUILD_WITH_LIBPQOS_LIBS)
 +
 +if test "x$with_libpqos" = "xyes"; then
 +  BUILD_WITH_LIBPQOS_CPPFLAGS="$with_libpqos_cppflags"
 +  BUILD_WITH_LIBPQOS_LDFLAGS="$with_libpqos_ldflags"
 +  BUILD_WITH_LIBPQOS_LIBS="-lpqos"
  fi
 +
 +AC_SUBST([BUILD_WITH_LIBPQOS_CPPFLAGS])
 +AC_SUBST([BUILD_WITH_LIBPQOS_LDFLAGS])
 +AC_SUBST([BUILD_WITH_LIBPQOS_LIBS])
  # }}}
  
+ # --with-libjevents {{{
+ with_libjevents_cppflags=""
+ with_libjevents_ldflags=""
+ AC_ARG_WITH([libjevents],
+   [AS_HELP_STRING([--with-libjevents@<:@=PREFIX@:>@], [Path to libjevents.])],
+   [
+     if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
+       with_libjevents_cppflags="-I$withval/include"
+       with_libjevents_ldflags="-L$withval/lib"
+       with_libjevents="yes"
+     else
+       with_libjevents="$withval"
+     fi
+   ],
+   [with_libjevents="yes"]
+ )
+ if test "x$with_libjevents" = "xyes"; then
+   SAVE_CPPFLAGS="$CPPFLAGS"
+   CPPFLAGS="$CPPFLAGS $with_libjevents_cppflags"
+   AC_CHECK_HEADERS([jevents.h], [with_libjevents="yes"], [with_libjevents="no (jevents.h not found)"])
+   CPPFLAGS="$SAVE_CPPFLAGS"
+ fi
+ if test "x$with_libjevents" = "xyes"; then
+   SAVE_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $with_libjevents_ldflags"
+   AC_CHECK_LIB([jevents], [json_events], [with_libjevents="yes"], [with_libjevents="no (Can't find libjevents)"])
+   LDFLAGS="$SAVE_LDFLAGS"
+ fi
+ if test "x$with_libjevents" = "xyes"; then
+   BUILD_WITH_LIBJEVENTS_CPPFLAGS="$with_libjevents_cppflags"
+   BUILD_WITH_LIBJEVENTS_LDFLAGS="$with_libjevents_ldflags"
+   BUILD_WITH_LIBJEVENTS_LIBS="-ljevents"
+ fi
+ AC_SUBST([BUILD_WITH_LIBJEVENTS_CPPFLAGS])
+ AC_SUBST([BUILD_WITH_LIBJEVENTS_LDFLAGS])
+ AC_SUBST([BUILD_WITH_LIBJEVENTS_LIBS])
+ # }}}
  # --with-libprotobuf {{{
  with_libprotobuf_cppflags=""
  with_libprotobuf_ldflags=""
@@@ -5375,10 -5353,6 +5418,10 @@@ if test "x$with_libupsclient" = "xyes"
      [AC_DEFINE([HAVE_UPSCLI_INIT], [1], [Define when upscli_init() (since version 2-7) is available.])]
    )
  
 +  AC_CHECK_LIB([upsclient], [upscli_tryconnect],
 +    [AC_DEFINE([HAVE_UPSCLI_TRYCONNECT], [1], [Define when upscli_tryconnect() (since version 2.6.2) is available.])]
 +  )
 +
    LDFLAGS="$SAVE_LDFLAGS"
  fi
  
@@@ -6083,6 -6057,7 +6126,7 @@@ plugin_fscache="no
  plugin_gps="no"
  plugin_grpc="no"
  plugin_hugepages="no"
+ plugin_intel_pmu="no"
  plugin_intel_rdt="no"
  plugin_interface="no"
  plugin_ipc="no"
@@@ -6158,14 -6133,14 +6202,14 @@@ if test "x$ac_system" = "xLinux"; the
    plugin_wireless="yes"
    plugin_zfs_arc="yes"
  
 -  if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"; then
 +  if test "x$ac_cv_header_linux_ip_vs_h" = "xyes"; then
      plugin_ipvs="yes"
    fi
  
    if test "x$c_cv_have_usable_asm_msrindex_h" = "xyes" && test "x$have_cpuid_h" = "xyes"; then
      plugin_turbostat="yes"
    fi
 -  
 +
    if test "x$c_cv_have_clock_boottime_monotonic" = "xyes"; then
      plugin_cpusleep="yes"
    fi
@@@ -6491,6 -6466,7 +6535,7 @@@ AC_PLUGIN([gps],                 [$plug
  AC_PLUGIN([grpc],                [$plugin_grpc],            [gRPC plugin])
  AC_PLUGIN([hddtemp],             [yes],                     [Query hddtempd])
  AC_PLUGIN([hugepages],           [$plugin_hugepages],       [Hugepages statistics])
+ AC_PLUGIN([intel_pmu],           [$with_libjevents],        [Intel performance monitor plugin])
  AC_PLUGIN([intel_rdt],           [$with_libpqos],           [Intel RDT monitor plugin])
  AC_PLUGIN([interface],           [$plugin_interface],       [Interface traffic statistics])
  AC_PLUGIN([ipc],                 [$plugin_ipc],             [IPC statistics])
@@@ -6559,7 -6535,6 +6604,7 @@@ AC_PLUGIN([serial],              [$plug
  AC_PLUGIN([sigrok],              [$with_libsigrok],         [sigrok acquisition sources])
  AC_PLUGIN([smart],               [$plugin_smart],           [SMART statistics])
  AC_PLUGIN([snmp],                [$with_libnetsnmp],        [SNMP querying plugin])
 +AC_PLUGIN([snmp_agent],          [$with_libnetsnmpagent],   [SNMP agent plugin])
  AC_PLUGIN([statsd],              [yes],                     [StatsD plugin])
  AC_PLUGIN([swap],                [$plugin_swap],            [Swap usage statistics])
  AC_PLUGIN([syslog],              [$have_syslog],            [Syslog logging plugin])
@@@ -6640,7 -6615,8 +6685,7 @@@ AC_SUBST([LOAD_PLUGIN_SYSLOG]
  AC_SUBST([LOAD_PLUGIN_LOGFILE])
  AC_SUBST([LOAD_PLUGIN_LOG_LOGSTASH])
  
 -if test "x$enable_debug" = "xyes"
 -then
 +if test "x$enable_debug" = "xyes"; then
    DEFAULT_LOG_LEVEL="debug"
  else
    DEFAULT_LOG_LEVEL="info"
@@@ -6685,11 -6661,21 +6730,11 @@@ AC_SUBST([LOAD_PLUGIN_RRDTOOL]
  AC_SUBST([LOAD_PLUGIN_NETWORK])
  AC_SUBST([LOAD_PLUGIN_CSV])
  
 -dnl ip_vs.h
 -if test "x$ac_system" = "xLinux" && test "x$have_linux_ip_vs_h" = "xno" && "x$have_net_ip_vs_h" = "xno" && "x$have_ip_vs_h" = "xno"; then
 -  enable_ipvs="$enable_ipvs (ip_vs.h not found)"
 -fi
 -
 -if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"; then
 -  enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
 -fi
 -
  dnl Perl bindings
  PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
  AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
  [
 -  if test "x$withval" != "xno" && test "x$withval" != "xyes"
 -  then
 +  if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
      PERL_BINDINGS_OPTIONS="$withval"
      with_perl_bindings="yes"
    else
    fi
  ],
  [
 -  if test "x$PERL" != "x"
 -  then
 +  if test "x$PERL" != "x"; then
      with_perl_bindings="yes"
    else
      with_perl_bindings="no (no perl interpreter found)"
    fi
  ])
  
 -if test "x$with_perl_bindings" = "xyes"
 -then
 -      AC_MSG_CHECKING([for the ExtUtils::MakeMaker module])
 -      if $PERL -MExtUtils::MakeMaker -e '' 2>/dev/null; then
 -              AC_MSG_RESULT([yes])
 -      else
 -              AC_MSG_RESULT([no])
 -              with_perl_bindings="no (ExtUtils::MakeMaker not found)"
 -      fi
 +if test "x$with_perl_bindings" = "xyes"; then
 +  AC_MSG_CHECKING([for the ExtUtils::MakeMaker module])
 +  if $PERL -MExtUtils::MakeMaker -e '' 2>/dev/null; then
 +    AC_MSG_RESULT([yes])
 +  else
 +    AC_MSG_RESULT([no])
 +    with_perl_bindings="no (ExtUtils::MakeMaker not found)"
 +  fi
  fi
  
 -if test "x$with_perl_bindings" = "xyes"
 -then
 +if test "x$with_perl_bindings" = "xyes"; then
    PERL_BINDINGS="perl"
  else
    PERL_BINDINGS=""
@@@ -6780,7 -6769,6 +6825,7 @@@ AC_MSG_RESULT(
  AC_MSG_RESULT([Configuration:])
  AC_MSG_RESULT([  Build:])
  AC_MSG_RESULT([    Platform  . . . . . . $ac_system])
 +AC_MSG_RESULT([    Compiler vendor . . . $ax_cv_c_compiler_vendor])
  AC_MSG_RESULT([    CC  . . . . . . . . . $CC])
  AC_MSG_RESULT([    CFLAGS  . . . . . . . $AM_CFLAGS $CFLAGS])
  AC_MSG_RESULT([    CXXFLAGS  . . . . . . $AM_CXXFLAGS $CXXFLAGS])
@@@ -6809,6 -6797,7 +6854,7 @@@ AC_MSG_RESULT([    libhiredis  . . . . 
  AC_MSG_RESULT([    libi2c-dev  . . . . . $with_libi2c])
  AC_MSG_RESULT([    libiokit  . . . . . . $with_libiokit])
  AC_MSG_RESULT([    libiptc . . . . . . . $with_libiptc])
+ AC_MSG_RESULT([    libjevents  . . . . . $with_libjevents])
  AC_MSG_RESULT([    libjvm  . . . . . . . $with_java])
  AC_MSG_RESULT([    libkstat  . . . . . . $with_kstat])
  AC_MSG_RESULT([    libkvm  . . . . . . . $with_libkvm])
@@@ -6824,7 -6813,6 +6870,7 @@@ AC_MSG_RESULT([    libmosquitto  . . . 
  AC_MSG_RESULT([    libmysql  . . . . . . $with_libmysql])
  AC_MSG_RESULT([    libnetapp . . . . . . $with_libnetapp])
  AC_MSG_RESULT([    libnetsnmp  . . . . . $with_libnetsnmp])
 +AC_MSG_RESULT([    libnetsnmpagent . . . $with_libnetsnmpagent])
  AC_MSG_RESULT([    libnotify . . . . . . $with_libnotify])
  AC_MSG_RESULT([    libopenipmi . . . . . $with_libopenipmipthread])
  AC_MSG_RESULT([    liboping  . . . . . . $with_liboping])
@@@ -6907,6 -6895,7 +6953,7 @@@ AC_MSG_RESULT([    gps . . . . . . . . 
  AC_MSG_RESULT([    grpc  . . . . . . . . $enable_grpc])
  AC_MSG_RESULT([    hddtemp . . . . . . . $enable_hddtemp])
  AC_MSG_RESULT([    hugepages . . . . . . $enable_hugepages])
+ AC_MSG_RESULT([    intel_pmu . . . . . . $enable_intel_pmu])
  AC_MSG_RESULT([    intel_rdt . . . . . . $enable_intel_rdt])
  AC_MSG_RESULT([    interface . . . . . . $enable_interface])
  AC_MSG_RESULT([    ipc . . . . . . . . . $enable_ipc])
@@@ -6974,7 -6963,6 +7021,7 @@@ AC_MSG_RESULT([    serial  . . . . . . 
  AC_MSG_RESULT([    sigrok  . . . . . . . $enable_sigrok])
  AC_MSG_RESULT([    smart . . . . . . . . $enable_smart])
  AC_MSG_RESULT([    snmp  . . . . . . . . $enable_snmp])
 +AC_MSG_RESULT([    snmp_agent  . . . . . $enable_snmp_agent])
  AC_MSG_RESULT([    statsd  . . . . . . . $enable_statsd])
  AC_MSG_RESULT([    swap  . . . . . . . . $enable_swap])
  AC_MSG_RESULT([    syslog  . . . . . . . $enable_syslog])
@@@ -19,6 -19,7 +19,7 @@@ ProtectHome=tru
  #   dns             CAP_NET_RAW
  #   exec            CAP_SETUID CAP_SETGID
  #   intel_rdt       CAP_SYS_RAWIO
+ #   intel_pmu       CAP_SYS_ADMIN
  #   iptables        CAP_NET_ADMIN
  #   ping            CAP_NET_RAW
  #   smart           CAP_SYS_RAWIO
@@@ -30,6 -31,8 +31,6 @@@
  # By default, drop all capabilities:
  CapabilityBoundingSet=
  
 -NoNewPrivileges=true
 -
  # Tell systemd it will receive a notification from collectd over its control
  # socket once the daemon is ready. See systemd.service(5) for more details.
  Type=notify
diff --combined src/collectd.conf.in
  #@BUILD_PLUGIN_GRPC_TRUE@LoadPlugin grpc
  #@BUILD_PLUGIN_HDDTEMP_TRUE@LoadPlugin hddtemp
  #@BUILD_PLUGIN_HUGEPAGES_TRUE@LoadPlugin hugepages
+ #@BUILD_PLUGIN_INTEL_PMU_TRUE@LoadPlugin intel_pmu
  #@BUILD_PLUGIN_INTEL_RDT_TRUE@LoadPlugin intel_rdt
  @BUILD_PLUGIN_INTERFACE_TRUE@@BUILD_PLUGIN_INTERFACE_TRUE@LoadPlugin interface
  #@BUILD_PLUGIN_IPC_TRUE@LoadPlugin ipc
  #@BUILD_PLUGIN_SIGROK_TRUE@LoadPlugin sigrok
  #@BUILD_PLUGIN_SMART_TRUE@LoadPlugin smart
  #@BUILD_PLUGIN_SNMP_TRUE@LoadPlugin snmp
 +#@BUILD_PLUGIN_SNMP_AGENT_TRUE@LoadPlugin snmp_agent
  #@BUILD_PLUGIN_STATSD_TRUE@LoadPlugin statsd
  #@BUILD_PLUGIN_SWAP_TRUE@LoadPlugin swap
  #@BUILD_PLUGIN_TABLE_TRUE@LoadPlugin table
  #  <EAL>
  #    Coremask "0x1"
  #    MemoryChannels "4"
 -#    ProcessType "secondary"
  #    FilePrefix "rte"
  #  </EAL>
  #  <Event "link_status">
  #  <EAL>
  #    Coremask "0x2"
  #    MemoryChannels "4"
 -#    ProcessType "secondary"
  #    FilePrefix "rte"
  #  </EAL>
  #  SharedMemObj "dpdk_collectd_stats_0"
  #    ValuesPercentage false
  #</Plugin>
  
+ #<Plugin intel_pmu>
+ #    ReportHardwareCacheEvents true
+ #    ReportKernelPMUEvents true
+ #    ReportSoftwareEvents true
+ #    EventList "/var/cache/pmu/GenuineIntel-6-2D-core.json"
+ #    HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD"
+ #</Plugin>
  #<Plugin "intel_rdt">
  #  Cores "0-2"
  #</Plugin>
  #     ForceSSL true
  #     VerifyPeer true
  #     CAPath "/path/to/folder"
 +#     #ConnectTimeout 5000
  #</Plugin>
  
  #<Plugin olsrd>
  #   </Host>
  #</Plugin>
  
 +#<Plugin snmp_agent>
 +#  <Data "memAvailReal">
 +#    Plugin "memory"
 +#    Type "memory"
 +#    TypeInstance "free"
 +#    OIDs "1.3.6.1.4.1.2021.4.6.0"
 +#  </Data>
 +#  <Table "ifTable">
 +#    IndexOID "IF-MIB::ifIndex"
 +#    SizeOID "IF-MIB::ifNumber"
 +#    <Data "ifDescr">
 +#      Instance true
 +#      Plugin "interface"
 +#      OIDs "IF-MIB::ifDescr"
 +#    </Data>
 +#    <Data "ifOctets">
 +#      Plugin "interface"
 +#      Type "if_octets"
 +#      TypeInstance ""
 +#      OIDs "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
 +#    </Data>
 +#  </Table>
 +#</Plugin>
 +
  #<Plugin statsd>
  #  Host "::"
  #  Port "8125"
diff --combined src/collectd.conf.pod
@@@ -2408,6 -2408,7 +2408,6 @@@ B<Synopsis:
     <EAL>
       Coremask "0x1"
       MemoryChannels "4"
 -     ProcessType "secondary"
       FilePrefix "rte"
     </EAL>
     <Event "link_status">
@@@ -2430,7 -2431,7 +2430,7 @@@ B<Options:
  
  =head3 The EAL block
  
 -=over 5
 +=over 4
  
  =item B<Coremask> I<Mask>
  
  
  Number of memory channels per processor socket.
  
 -=item B<ProcessType> I<type>
 -
 -The type of DPDK process instance.
 -
  =item B<FilePrefix> I<File>
  
  The prefix text used for hugepage filenames. The filename will be set to
@@@ -2452,7 -2457,7 +2452,7 @@@ single argument which specifies the nam
  
  =head4 Link Status event
  
 -=over 5
 +=over 4
  
  =item B<SendEventOnUpdate> I<true|false>
  
@@@ -2485,7 -2490,7 +2485,7 @@@ value is false
  
  =head4 Keep Alive event
  
 -=over 5
 +=over 4
  
  =item B<SendEventOnUpdate> I<true|false>
  
@@@ -2521,6 -2526,7 +2521,6 @@@ B<Synopsis:
     <EAL>
       Coremask "0x4"
       MemoryChannels "4"
 -     ProcessType "secondary"
       FilePrefix "rte"
       SocketMemory "1024"
     </EAL>
@@@ -2534,7 -2540,7 +2534,7 @@@ B<Options:
  
  =head3 The EAL block
  
 -=over 5
 +=over 4
  
  =item B<Coremask> I<Mask>
  
@@@ -2545,6 -2551,10 +2545,6 @@@ core numbering can change between platf
  
  A string containing a number of memory channels per processor socket.
  
 -=item B<ProcessType> I<type>
 -
 -A string containing the type of DPDK process instance.
 -
  =item B<FilePrefix> I<File>
  
  The prefix text used for hugepage filenames. The filename will be set to
@@@ -2560,7 -2570,6 +2560,7 @@@ sockets in MB. This is an optional valu
  =over 3
  
  =item B<SharedMemObj> I<Mask>
 +
  A string containing the name of the shared memory object that should be used to
  share stats from the DPDK secondary process to the collectd dpdkstat plugin.
  Defaults to dpdk_collectd_stats if no other value is configured.
@@@ -3073,6 -3082,92 +3073,92 @@@ Defaults to B<false>
  
  =back
  
+ =head2 Plugin C<intel_pmu>
+ The I<intel_pmu> plugin collects performance counters data on Intel CPUs using
+ Linux perf interface. All events are reported on a per core basis.
+ B<Synopsis:>
+   <Plugin intel_pmu>
+     ReportHardwareCacheEvents true
+     ReportKernelPMUEvents true
+     ReportSoftwareEvents true
+     EventList "/var/cache/pmu/GenuineIntel-6-2D-core.json"
+     HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD"
+   </Plugin>
+ B<Options:>
+ =over 4
+ =item B<ReportHardwareCacheEvents> B<false>|B<true>
+ Enable or disable measuring of hardware CPU cache events:
+   - L1-dcache-loads
+   - L1-dcache-load-misses
+   - L1-dcache-stores
+   - L1-dcache-store-misses
+   - L1-dcache-prefetches
+   - L1-dcache-prefetch-misses
+   - L1-icache-loads
+   - L1-icache-load-misses
+   - L1-icache-prefetches
+   - L1-icache-prefetch-misses
+   - LLC-loads
+   - LLC-load-misses
+   - LLC-stores
+   - LLC-store-misses
+   - LLC-prefetches
+   - LLC-prefetch-misses
+   - dTLB-loads
+   - dTLB-load-misses
+   - dTLB-stores
+   - dTLB-store-misses
+   - dTLB-prefetches
+   - dTLB-prefetch-misses
+   - iTLB-loads
+   - iTLB-load-misses
+   - branch-loads
+   - branch-load-misses
+ =item B<ReportKernelPMUEvents> B<false>|B<true>
+ Enable or disable measuring of the following events:
+   - cpu-cycles
+   - instructions
+   - cache-references
+   - cache-misses
+   - branches
+   - branch-misses
+   - bus-cycles
+ =item B<ReportSoftwareEvents> B<false>|B<true>
+ Enable or disable measuring of software events provided by kernel:
+   - cpu-clock
+   - task-clock
+   - context-switches
+   - cpu-migrations
+   - page-faults
+   - minor-faults
+   - major-faults
+   - alignment-faults
+   - emulation-faults
+ =item B<EventList> I<filename>
+ JSON performance counter event list file name. To be able to monitor all Intel
+ CPU specific events JSON event list file should be downloaded. Use the pmu-tools
+ event_download.py script to download event list for current CPU.
+ =item B<HardwareEvents> I<events>
+ This field is a list of event names or groups of comma separated event names.
+ This option requires B<EventList> option to be configured.
+ =back
  =head2 Plugin C<intel_rdt>
  
  The I<intel_rdt> plugin collects information provided by monitoring features of
@@@ -3144,7 -3239,7 +3230,7 @@@ See F</"IGNORELISTS"> for details
  
  =item B<IgnoreSelected> I<true>|I<false>
  
 -If no configuration if given, the B<interface>-plugin will collect data from
 +If no configuration is given, the B<interface>-plugin will collect data from
  all interfaces. This may not be practical, especially for loopback- and
  similar interfaces. Thus, you can use the B<Interface>-option to pick the
  interfaces you're interested in. Sometimes, however, it's easier/preferred
@@@ -5291,11 -5386,6 +5377,11 @@@ generate links like the one described a
  Example usage:
  C<c_rehash /path/to/certs/folder>
  
 +=item B<ConnectTimeout> I<Milliseconds>
 +
 +The B<ConnectTimeout> option sets the connect timeout, in milliseconds.
 +By default, the configured B<Interval> is used to set the timeout.
 +
  =back
  
  =head2 Plugin C<olsrd>
@@@ -5861,10 -5951,10 +5947,10 @@@ multiple hosts
  =item B<Interval> I<Seconds>
  
  Sets the interval in which to send ICMP echo packets to the configured hosts.
 -This is B<not> the interval in which statistics are queries from the plugin but
 -the interval in which the hosts are "pinged". Therefore, the setting here
 -should be smaller than or equal to the global B<Interval> setting. Fractional
 -times, such as "1.24" are allowed.
 +This is B<not> the interval in which metrics are read from the plugin but the
 +interval in which the hosts are "pinged". Therefore, the setting here should be
 +smaller than or equal to the global B<Interval> setting. Fractional times, such
 +as "1.24" are allowed.
  
  Default: B<1.0>
  
@@@ -7178,122 -7268,6 +7264,122 @@@ Since the configuration of the C<snmp p
  other plugins, its documentation has been moved to an own manpage,
  L<collectd-snmp(5)>. Please see there for details.
  
 +=head2 Plugin C<snmp_agent>
 +
 +The I<snmp_agent> plugin is an AgentX subagent that receives and handles queries
 +from SNMP master agent and returns the data collected by read plugins.
 +The I<snmp_agent> plugin handles requests only for OIDs specified in
 +configuration file. To handle SNMP queries the plugin gets data from collectd
 +and translates requested values from collectd's internal format to SNMP format.
 +This plugin is a generic plugin and cannot work without configuration.
 +For more details on AgentX subagent see
 +<http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demon/>
 +
 +B<Synopsis:>
 +
 +  <Plugin snmp_agent>
 +    <Data "memAvailReal">
 +      Plugin "memory"
 +      #PluginInstance "some"
 +      Type "memory"
 +      TypeInstance "free"
 +      OIDs "1.3.6.1.4.1.2021.4.6.0"
 +    </Data>
 +    <Table "ifTable">
 +      IndexOID "IF-MIB::ifIndex"
 +      SizeOID "IF-MIB::ifNumber"
 +      <Data "ifDescr">
 +        Instance true
 +        Plugin "interface"
 +        OIDs "IF-MIB::ifDescr"
 +      </Data>
 +      <Data "ifOctets">
 +        Plugin "interface"
 +        Type "if_octets"
 +        TypeInstance ""
 +        OIDs "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
 +      </Data>
 +    </Table>
 +  </Plugin>
 +
 +There are two types of blocks that can be contained in the
 +C<E<lt>PluginE<nbsp> snmp_agentE<gt>> block: B<Data> and B<Table>:
 +
 +=head3 The B<Data> block
 +
 +The B<Data> block defines a list OIDs that are to be handled. This block can
 +define scalar or table OIDs. If B<Data> block is defined inside of B<Table>
 +block it reperesents table OIDs.
 +The following options can be set:
 +
 +=over 4
 +
 +=item B<Instance> I<true|false>
 +
 +When B<Instance> is set to B<true>, the value for requested OID is copied from
 +plugin instance field of corresponding collectd value. If B<Data> block defines
 +scalar data type B<Instance> has no effect and can be omitted.
 +
 +=item B<Plugin> I<String>
 +
 +Read plugin name whose collected data will be mapped to specified OIDs.
 +
 +=item B<PluginInstance> I<String>
 +
 +Read plugin instance whose collected data will be mapped to specified OIDs.
 +The field is optional and by default there is no plugin instance check.
 +Allowed only if B<Data> block defines scalar data type.
 +
 +=item B<Type> I<String>
 +
 +Collectd's type that is to be used for specified OID, e.E<nbsp>g. "if_octets"
 +for example. The types are read from the B<TypesDB> (see L<collectd.conf(5)>).
 +
 +=item B<TypeInstance> I<String>
 +
 +Collectd's type-instance that is to be used for specified OID.
 +
 +=item B<OIDs> I<OID> [I<OID> ...]
 +
 +Configures the OIDs to be handled by I<snmp_agent> plugin. Values for these OIDs
 +are taken from collectd data type specified by B<Plugin>, B<PluginInstance>,
 +B<Type>, B<TypeInstance> fields of this B<Data> block. Number of the OIDs
 +configured should correspond to number of values in specified B<Type>.
 +For example two OIDs "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets" can be mapped to
 +"rx" and "tx" values of "if_octets" type.
 +
 +=item B<Scale> I<Value>
 +
 +The values taken from collectd are multiplied by I<Value>. The field is optional
 +and the default is B<1.0>.
 +
 +=item B<Shift> I<Value>
 +
 +I<Value> is added to values from collectd after they have been multiplied by
 +B<Scale> value. The field is optional and the default value is B<0.0>.
 +
 +=back
 +
 +=head3 The B<Table> block
 +
 +The B<Table> block defines a collection of B<Data> blocks that belong to one
 +snmp table. In addition to multiple B<Data> blocks the following options can be
 +set:
 +
 +=over 4
 +
 +=item B<IndexOID> I<OID>
 +
 +OID that is handled by the plugin and is mapped to numerical index value that is
 +generated by the plugin for each table record.
 +
 +=item B<SizeOID> I<OID>
 +
 +OID that is handled by the plugin. Returned value is the number of records in
 +the table. The field is optional.
 +
 +=back
 +
  =head2 Plugin C<statsd>
  
  The I<statsd plugin> listens to a UDP socket, reads "events" in the statsd