From: Pavel Rochnyak Date: Sat, 20 Oct 2018 11:17:11 +0000 (+0700) Subject: Merge pull request #2806 from rorysexton/dev_turbostat_plugin X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=009c673408d3e05f8604b3fb818cf3358f984be3;hp=7f709d3ff337e5fdc5fc5f53ebfcbe6050215046 Merge pull request #2806 from rorysexton/dev_turbostat_plugin turbostat plugin: New metrics: P-states,Turboboost,Platform TDP,Uncore bus ratio --- diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..009ae439 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gnulib"] + path = gnulib + url = git://git.savannah.gnu.org/gnulib.git diff --git a/.travis.yml b/.travis.yml index 1bd6142d..97115d14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,7 +75,7 @@ before_script: autoreconf -fi script: - if [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]; then exit 0; fi - ./configure - - make -j 4 + - make -j $(nproc) - make check addons: @@ -85,5 +85,5 @@ addons: description: "Build submitted via Travis CI" notification_email: collectd-changes@verplant.org build_command_prepend: "./configure; make clean" - build_command: "make -j 4" + build_command: "make -j $(nproc)" branch_pattern: coverity_scan diff --git a/Makefile.am b/Makefile.am index 612346e1..f929ffc2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,15 @@ ACLOCAL_AMFLAGS = -I m4 AM_YFLAGS = -d +if BUILD_WIN32 +cpkgdatadir=$(datadir) +cpkglibdir=$(libdir)/plugins +cpkglocalstatedir=${localstatedir} +else +cpkgdatadir=$(pkgdatadir) +cpkglibdir=$(pkglibdir) +cpkglocalstatedir=${localstatedir}/lib/${PACKAGE_NAME} +endif BUILT_SOURCES = \ src/libcollectdclient/collectd/lcc_features.h \ @@ -99,7 +108,13 @@ pkginclude_HEADERS = \ lib_LTLIBRARIES = libcollectdclient.la +if BUILD_WIN32 +# TODO: Build all executables on Windows as well. +sbin_PROGRAMS = \ + collectd +bin_PROGRAMS = +else sbin_PROGRAMS = \ collectd \ collectdmon @@ -109,6 +124,7 @@ bin_PROGRAMS = \ collectd-nagios \ collectd-tg \ collectdctl +endif # BUILD_WIN32 noinst_LTLIBRARIES = \ @@ -151,7 +167,7 @@ TESTS = $(check_PROGRAMS) LOG_COMPILER = env VALGRIND="@VALGRIND@" $(abs_srcdir)/testwrapper.sh -jardir = $(pkgdatadir)/java +jardir = $(cpkgdatadir)/java pkglib_LTLIBRARIES = @@ -160,6 +176,9 @@ PLUGIN_LDFLAGS = \ -module \ -avoid-version \ -export-symbols-regex '\' +if BUILD_WIN32 +PLUGIN_LDFLAGS += -shared -no-undefined -lcollectd -L. +endif AM_CPPFLAGS = \ @@ -167,13 +186,26 @@ AM_CPPFLAGS = \ -DPREFIX='"${prefix}"' \ -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \ -DLOCALSTATEDIR='"${localstatedir}"' \ - -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"' \ - -DPLUGINDIR='"${pkglibdir}"' \ - -DPKGDATADIR='"${pkgdatadir}"' + -DPKGLOCALSTATEDIR='"${cpkglocalstatedir}"' \ + -DPLUGINDIR='"${cpkglibdir}"' \ + -DPKGDATADIR='"${cpkgdatadir}"' +if BUILD_WIN32 +AM_CPPFLAGS += -DNOGDI +endif +COMMON_DEPS = +if BUILD_WIN32 +COMMON_DEPS += collectd.exe +endif # Link to these libraries.. COMMON_LIBS = $(PTHREAD_LIBS) +if BUILD_WIN32 +COMMON_LIBS += -lws2_32 +endif +if BUILD_WITH_GNULIB +COMMON_LIBS += -lgnu +endif if BUILD_WITH_CAPABILITY COMMON_LIBS += -lcap endif @@ -195,6 +227,7 @@ endif collectd_SOURCES = \ + src/daemon/cmd.h \ src/daemon/collectd.c \ src/daemon/collectd.h \ src/daemon/configfile.c \ @@ -237,6 +270,13 @@ collectd_LDADD = \ $(COMMON_LIBS) \ $(DLOPEN_LIBS) +if BUILD_WIN32 +collectd_SOURCES += src/daemon/cmd_windows.c +collectd_LDFLAGS += -ldl -Wl,--out-implib,libcollectd.a +else +collectd_SOURCES += src/daemon/cmd.c +endif + if BUILD_FEATURE_DAEMON collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"' endif @@ -248,6 +288,9 @@ collectd_CFLAGS += $(BUILD_WITH_LIBSTATGRAB_CFLAGS) collectd_LDADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS) endif +if BUILD_WIN32 +collectd_LDFLAGS += -Wl,--out-implib,libcollectd.a +endif collectdmon_SOURCES = src/collectdmon.c @@ -499,6 +542,10 @@ libcollectdclient_la_CPPFLAGS = \ -I$(srcdir)/src/daemon libcollectdclient_la_LDFLAGS = -version-info 2:0:1 libcollectdclient_la_LIBADD = -lm +if BUILD_WIN32 +libcollectdclient_la_LDFLAGS += -shared -no-undefined +libcollectdclient_la_LIBADD += -lgnu -lws2_32 -liphlpapi +endif if BUILD_WITH_LIBGCRYPT libcollectdclient_la_CPPFLAGS += $(GCRYPT_CPPFLAGS) libcollectdclient_la_LDFLAGS += $(GCRYPT_LDFLAGS) @@ -527,6 +574,68 @@ liboconfig_la_SOURCES = \ liboconfig_la_CPPFLAGS = -I$(srcdir)/src/liboconfig $(AM_CPPFLAGS) liboconfig_la_LDFLAGS = -avoid-version $(LEXLIB) +if BUILD_WITH_LIBCURL +if BUILD_WITH_LIBSSL +if BUILD_WITH_LIBYAJL2 +noinst_LTLIBRARIES += liboauth.la +liboauth_la_SOURCES = \ + src/utils_oauth.c \ + src/utils_oauth.h +liboauth_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(BUILD_WITH_LIBCURL_CFLAGS) \ + $(BUILD_WITH_LIBSSL_CFLAGS) \ + $(BUILD_WITH_LIBYAJL_CPPFLAGS) +liboauth_la_LIBADD = \ + $(BUILD_WITH_LIBCURL_LIBS) \ + $(BUILD_WITH_LIBSSL_LIBS) \ + $(BUILD_WITH_LIBYAJL_LIBS) + +check_PROGRAMS += test_utils_oauth +TESTS += test_utils_oauth +test_utils_oauth_SOURCES = \ + src/utils_oauth_test.c +test_utils_oauth_LDADD = \ + liboauth.la \ + libcommon.la \ + libplugin_mock.la + +noinst_LTLIBRARIES += libgce.la +libgce_la_SOURCES = \ + src/utils_gce.c \ + src/utils_gce.h +libgce_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(BUILD_WITH_LIBCURL_CFLAGS) +libgce_la_LIBADD = \ + $(BUILD_WITH_LIBCURL_LIBS) +endif +endif +endif + +if BUILD_WITH_LIBYAJL2 +noinst_LTLIBRARIES += libformat_stackdriver.la +libformat_stackdriver_la_SOURCES = \ + src/utils_format_stackdriver.c \ + src/utils_format_stackdriver.h +libformat_stackdriver_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(BUILD_WITH_LIBYAJL_CPPFLAGS) +libformat_stackdriver_la_LIBADD = \ + libavltree.la \ + $(BUILD_WITH_LIBSSL_LIBS) \ + $(BUILD_WITH_LIBYAJL_LIBS) + +check_PROGRAMS += test_format_stackdriver +TESTS += test_format_stackdriver +test_format_stackdriver_SOURCES = \ + src/utils_format_stackdriver_test.c \ + src/testing.h +test_format_stackdriver_LDADD = \ + libformat_stackdriver.la \ + libplugin_mock.la \ + -lm +endif if BUILD_PLUGIN_AGGREGATION pkglib_LTLIBRARIES += aggregation.la @@ -1040,6 +1149,7 @@ if BUILD_PLUGIN_LOGFILE pkglib_LTLIBRARIES += logfile.la logfile_la_SOURCES = src/logfile.c logfile_la_LDFLAGS = $(PLUGIN_LDFLAGS) +logfile_la_DEPENDENCIES = $(COMMON_DEPS) endif if BUILD_PLUGIN_LOG_LOGSTASH @@ -1379,6 +1489,24 @@ ovs_stats_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBYAJL_LDFLAGS) ovs_stats_la_LIBADD = $(BUILD_WITH_LIBYAJL_LIBS) endif +if BUILD_PLUGIN_PCIE_ERRORS +pkglib_LTLIBRARIES += pcie_errors.la +pcie_errors_la_SOURCES = src/pcie_errors.c +pcie_errors_la_CPPFLAGS = $(AM_CPPFLAGS) +pcie_errors_la_LDFLAGS = $(PLUGIN_LDFLAGS) + +test_plugin_pcie_errors_SOURCES = \ + src/pcie_errors_test.c \ + src/daemon/utils_llist.c \ + src/daemon/configfile.c \ + src/daemon/types_list.c +test_plugin_pcie_errors_CPPFLAGS = $(AM_CPPFLAGS) +test_plugin_pcie_errors_LDFLAGS = $(PLUGIN_LDFLAGS) +test_plugin_pcie_errors_LDADD = liboconfig.la libplugin_mock.la +check_PROGRAMS += test_plugin_pcie_errors +TESTS += test_plugin_pcie_errors +endif + if BUILD_PLUGIN_PERL pkglib_LTLIBRARIES += perl.la perl_la_SOURCES = src/perl.c @@ -1556,7 +1684,7 @@ pkglib_LTLIBRARIES += snmp.la snmp_la_SOURCES = src/snmp.c snmp_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBNETSNMP_CPPFLAGS) snmp_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBNETSNMP_LDFLAGS) -snmp_la_LIBADD = $(BUILD_WITH_LIBNETSNMP_LIBS) +snmp_la_LIBADD = libignorelist.la $(BUILD_WITH_LIBNETSNMP_LIBS) endif if BUILD_PLUGIN_SNMP_AGENT @@ -1565,6 +1693,23 @@ 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) + +test_plugin_snmp_agent_SOURCES = src/snmp_agent_test.c \ + src/daemon/utils_avltree.c \ + src/daemon/utils_llist.c \ + src/daemon/configfile.c \ + src/daemon/types_list.c +test_plugin_snmp_agent_CPPFLAGS = $(AM_CPPFLAGS) \ + $(BUILD_WITH_LIBNETSNMPAGENT_CPPFLAGS) +test_plugin_snmp_agent_LDFLAGS = $(PLUGIN_LDFLAGS) \ + $(BUILD_WITH_LIBNETSNMPAGENT_LDFLAGS) +test_plugin_snmp_agent_LDADD = liboconfig.la libplugin_mock.la \ + $(BUILD_WITH_LIBNETSNMPAGENT_LIBS) $(BUILD_WITH_LIBNETSNMP_LIBS) + +check_PROGRAMS += test_plugin_snmp_agent +TESTS += test_plugin_snmp_agent + + endif if BUILD_PLUGIN_STATSD @@ -1894,6 +2039,15 @@ write_sensu_la_SOURCES = src/write_sensu.c write_sensu_la_LDFLAGS = $(PLUGIN_LDFLAGS) endif +if BUILD_PLUGIN_WRITE_STACKDRIVER +pkglib_LTLIBRARIES += write_stackdriver.la +write_stackdriver_la_SOURCES = src/write_stackdriver.c +write_stackdriver_la_LDFLAGS = $(PLUGIN_LDFLAGS) +write_stackdriver_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBCURL_CFLAGS) +write_stackdriver_la_LIBADD = libformat_stackdriver.la libgce.la liboauth.la \ + $(BUILD_WITH_LIBCURL_LIBS) +endif + if BUILD_PLUGIN_WRITE_TSDB pkglib_LTLIBRARIES += write_tsdb.la write_tsdb_la_SOURCES = src/write_tsdb.c @@ -2013,15 +2167,15 @@ install-exec-hook: else \ $(INSTALL) -m 0640 $(builddir)/src/collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \ fi; \ - $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) - $(INSTALL) -m 0644 $(srcdir)/src/types.db $(DESTDIR)$(pkgdatadir)/types.db; + $(mkinstalldirs) $(DESTDIR)$(cpkgdatadir) + $(INSTALL) -m 0644 $(srcdir)/src/types.db $(DESTDIR)$(cpkgdatadir)/types.db; $(INSTALL) -m 0644 $(srcdir)/src/postgresql_default.conf \ - $(DESTDIR)$(pkgdatadir)/postgresql_default.conf; + $(DESTDIR)$(cpkgdatadir)/postgresql_default.conf; uninstall-hook: - rm -f $(DESTDIR)$(pkgdatadir)/types.db; + rm -f $(DESTDIR)$(cpkgdatadir)/types.db; rm -f $(DESTDIR)$(sysconfdir)/collectd.conf - rm -f $(DESTDIR)$(pkgdatadir)/postgresql_default.conf; + rm -f $(DESTDIR)$(cpkgdatadir)/postgresql_default.conf; all-local: @PERL_BINDINGS@ @@ -2101,3 +2255,4 @@ generic-jmx.jar: $(JAVA_TIMESTAMP_FILE) jar_DATA = collectd-api.jar generic-jmx.jar endif + diff --git a/README b/README index 2210b2b9..a5947038 100644 --- a/README +++ b/README @@ -314,6 +314,10 @@ Features OVS documentation. + - pcie_errors + Read errors from PCI Express Device Status and AER extended capabilities. + + - perl The perl plugin implements a Perl-interpreter into collectd. You can write your own plugins in Perl and return arbitrary values using this @@ -1040,6 +1044,37 @@ To generate the `configure` script, you'll need the following dependencies: The `build.sh' script takes no arguments. +Building on Windows +----------------------------------------------- + +Collectd can be built on Windows using Cygwin, and the result is a binary that +runs natively on Windows. That is, Cygwin is only needed for building, not running, +collectd. + +You will need to install the following Cygwin packages: +- automake +- bison +- flex +- git +- libtool +- make +- mingw64-x86_64-dlfcn +- mingw64-x86_64-gcc-core +- mingw64-x86_64-zlib +- pkg-config + +To build, just run the `build.sh' script in your Cygwin terminal. By default, it installs +to "C:/Program Files/collectd". You can change the location by setting the INSTALL_DIR +variable: + +$ export INSTALL_DIR="C:/some/other/install/directory" +$ ./build.sh + +or: + +$ INSTALL_DIR="C:/some/other/install/directory" ./build.sh + + Crosscompiling -------------- diff --git a/build.sh b/build.sh index bd4c1a31..c0ccce3a 100755 --- a/build.sh +++ b/build.sh @@ -18,34 +18,156 @@ EOF done } -check_for_application lex bison autoheader aclocal automake autoconf pkg-config - -libtoolize="" -libtoolize --version >/dev/null 2>/dev/null -if test $? -eq 0; then - libtoolize=libtoolize -else - glibtoolize --version >/dev/null 2>/dev/null +setup_libtool() +{ + libtoolize="" + libtoolize --version >/dev/null 2>/dev/null if test $? -eq 0; then - libtoolize=glibtoolize + libtoolize=libtoolize else - cat >&2 </dev/null 2>/dev/null + if test $? -eq 0; then + libtoolize=glibtoolize + else + cat >&2 <" >> src/gnulib_config.h + + cp libtool libtool_bak + sed -i "s%\$LTCC \$LTCFLAGS\(.*cwrapper.*\)%\$LTCC \1%" libtool + + make + make install + + cp "${GNULIB_DIR}/libgnu.dll" "${INSTALL_DIR}" + cp "${MINGW_ROOT}/bin/zlib1.dll" "${INSTALL_DIR}" + cp "${MINGW_ROOT}/bin/libwinpthread-1.dll" "${INSTALL_DIR}" + cp "${MINGW_ROOT}/bin/libdl.dll" "${INSTALL_DIR}" + + echo "Done." +} + +os_name="$(uname)" +if test "${os_name#CYGWIN}" != "$os_name"; then + build_cygwin +else + build +fi -autoheader \ -&& aclocal -I m4 \ -&& $libtoolize --copy --force \ -&& automake --add-missing --copy \ -&& autoconf diff --git a/configure.ac b/configure.ac index 1e31e218..46279652 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,10 @@ case $host_os in AC_DEFINE([KERNEL_SOLARIS], [1], [True if program is to be compiled for a Solaris kernel]) ac_system="Solaris" ;; + *mingw32*) + AC_DEFINE([KERNEL_WIN32], [1], [True if program is to be compiled for a Windows kernel]) + ac_system="Windows" + ;; *) ac_system="unknown" ;; @@ -111,6 +115,7 @@ AM_CONDITIONAL([BUILD_FREEBSD], [test "x$ac_system" = "xFreeBSD"]) AM_CONDITIONAL([BUILD_LINUX], [test "x$ac_system" = "xLinux"]) AM_CONDITIONAL([BUILD_OPENBSD], [test "x$ac_system" = "xOpenBSD"]) AM_CONDITIONAL([BUILD_SOLARIS], [test "x$ac_system" = "xSolaris"]) +AM_CONDITIONAL([BUILD_WIN32], [test "x$ac_system" = "xWindows"]) if test "x$ac_system" = "xSolaris"; then AC_DEFINE([_POSIX_PTHREAD_SEMANTICS], [1], [Define to enforce POSIX thread semantics under Solaris.]) @@ -550,6 +555,12 @@ if test "x$ac_system" = "xLinux"; then AC_DEFINE([HAVE_CAPABILITY], [1], [Define to 1 if you have cap_get_proc() (-lcap).]) fi + # For pcie_errors plugin + AC_CHECK_HEADERS([linux/pci_regs.h], + [have_pci_regs_h="yes"], + [have_pci_regs_h="no (linux/pci_regs.h not found)"] + ) + else have_linux_raid_md_u_h="no" have_linux_wireless_h="no" @@ -745,6 +756,7 @@ AC_CHECK_FUNCS_ONCE([ \ getaddrinfo \ getgrnam_r \ getnameinfo \ + getpwnam \ getpwnam_r \ gettimeofday \ if_indextoname \ @@ -767,6 +779,12 @@ AC_FUNC_STRERROR_R SAVE_CFLAGS="$CFLAGS" CFLAGS="-Wall -Werror" +SAVE_LDFLAGS="$LDFLAGS" +LDFLAGS="" +if test "x$ac_system" = "xWindows"; then + # This is exported from build.sh + LDFLAGS="$LDFLAGS -L${GNULIB_DIR}" +fi AC_CACHE_CHECK([for strtok_r], [c_cv_have_strtok_r_default], @@ -839,6 +857,7 @@ if test "x$c_cv_have_strtok_r_default" = "xno"; then fi CFLAGS="$SAVE_CFLAGS" +LDFLAGS="$SAVE_LDFLAGS" if test "x$c_cv_have_strtok_r_reentrant" = "xyes"; then CFLAGS="$CFLAGS -D_REENTRANT=1" fi @@ -848,11 +867,17 @@ AC_CHECK_FUNCS([socket], [ AC_CHECK_LIB([socket], [socket], [socket_needs_socket="yes"], - [AC_MSG_ERROR([cannot find socket() in libsocket])] + [ + AC_CHECK_LIB([gnu], [rpl_socket], + [socket_needs_gnulib="yes"], + [AC_MSG_ERROR([cannot find socket() in libsocket])] + ) + ] ) ] ) AM_CONDITIONAL([BUILD_WITH_LIBSOCKET], [test "x$socket_needs_socket" = "xyes"]) +AM_CONDITIONAL([BUILD_WITH_GNULIB], [test "x$socket_needs_gnulib" = "xyes"]) clock_gettime_needs_posix4="no" AC_CHECK_FUNCS([clock_gettime], @@ -2279,6 +2304,8 @@ fi AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS) AC_SUBST(BUILD_WITH_LIBCURL_LIBS) + +AM_CONDITIONAL([BUILD_WITH_LIBCURL], [test "x$with_libcurl" = "xyes"]) # }}} # --with-libdbi {{{ @@ -3814,7 +3841,7 @@ if test "x$with_libnetsnmp" = "xyes"; then LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags" AC_CHECK_LIB([netsnmp], [init_snmp], - [with_libnetsmp="yes"], + [with_libnetsnmp="yes"], [with_libnetsnmp="no (libnetsnmp not found)"] ) @@ -3822,6 +3849,62 @@ if test "x$with_libnetsnmp" = "xyes"; then fi if test "x$with_libnetsnmp" = "xyes"; then + SAVE_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags" + + AC_CHECK_LIB([netsnmp], [netsnmp_get_version], + [with_libnetsnmp="yes"], + [with_libnetsnmp="no (couldn't get libnetsnmp version)"] + ) + + LDFLAGS="$SAVE_LDFLAGS" +fi + +if test "x$with_libnetsnmp" = "xyes"; then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS $with_libnetsnmp_cppflags -Wall -Werror" + LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags" + LIBS="$LIBS -lnetsnmp" + + AC_CACHE_CHECK([whether netsnmp library has old API], + [c_cv_have_netsnmp_old_api], + [ + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + netsnmp_variable_list *key = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);; + int val; + u_char type = ASN_INTEGER; + snmp_set_var_value(key, &val, sizeof(val)); + snmp_set_var_typed_value(key, type, &val, sizeof(val)); + return 0; + ]] + ) + ], + [c_cv_have_netsnmp_old_api="no"], + [c_cv_have_netsnmp_old_api="yes"] + ) + ] + ) + + if test "x$c_cv_have_netsnmp_old_api" = "xyes"; then + AC_DEFINE([HAVE_NETSNMP_OLD_API], [1], + ["Define 1 if you have old netsnmp API]") + fi + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" +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" @@ -3832,7 +3915,7 @@ AC_SUBST([BUILD_WITH_LIBNETSNMP_LDFLAGS]) AC_SUBST([BUILD_WITH_LIBNETSNMP_LIBS]) # }}} -# --with-libnetsmpagent {{{ +# --with-libnetsnmpagent {{{ AC_ARG_WITH([libnetsnmpagent], [AS_HELP_STRING([--with-libnetsnmpagent@<:@=PREFIX@:>@], [Path to libnetsnmpagent.])], [ @@ -5153,6 +5236,55 @@ PKG_CHECK_MODULES([LIBSIGROK], [libsigrok < 0.4], ) # }}} +# --with-libssl {{{ +with_libssl_cflags="" +with_libssl_ldflags="" +AC_ARG_WITH([libssl], [AS_HELP_STRING([--with-libssl@<:@=PREFIX@:>@], [Path to libssl.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes"; then + with_libssl_cppflags="-I$withval/include" + with_libssl_ldflags="-L$withval/lib" + with_libssl="yes" + else + with_libssl="$withval" + fi +], +[ + with_libssl="yes" +]) +if test "x$with_libssl" = "xyes"; then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libssl_cppflags" + + AC_CHECK_HEADERS([openssl/sha.h openssl/blowfish.h openssl/rand.h], + [with_libssl="yes"], + [with_libssl="no (ssl header not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libssl" = "xyes"; then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_libssl_cppflags" + LDFLAGS="$LDFLAGS $with_libssl_ldflags" + + AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [with_libssl="yes"], [with_libssl="no (Symbol 'SSL_library_init' not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libssl" = "xyes"; then + BUILD_WITH_LIBSSL_CFLAGS="$with_libssl_cflags" + BUILD_WITH_LIBSSL_LDFLAGS="$with_libssl_ldflags" + BUILD_WITH_LIBSSL_LIBS="-lssl -lcrypto" + AC_SUBST([BUILD_WITH_LIBSSL_CFLAGS]) + AC_SUBST([BUILD_WITH_LIBSSL_LDFLAGS]) + AC_SUBST([BUILD_WITH_LIBSSL_LIBS]) + AC_DEFINE([HAVE_LIBSSL], [1], [Define if libssl is present and usable.]) +fi +AM_CONDITIONAL(BUILD_WITH_LIBSSL, test "x$with_libssl" = "xyes") +# }}} + # --with-libstatgrab {{{ AC_ARG_WITH([libstatgrab], [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])], @@ -5708,6 +5840,7 @@ AC_SUBST([BUILD_WITH_LIBYAJL_LDFLAGS]) AC_SUBST([BUILD_WITH_LIBYAJL_LIBS]) AM_CONDITIONAL([BUILD_WITH_LIBYAJL], [test "x$with_libyajl" = "xyes"]) +AM_CONDITIONAL([BUILD_WITH_LIBYAJL2], [test "x$with_libyajl$with_libyajl2" = "xyesyes"]) # }}} # --with-mic {{{ @@ -5839,32 +5972,41 @@ AC_SUBST([BUILD_WITH_LIBVARNISH_CFLAGS]) AC_SUBST([BUILD_WITH_LIBVARNISH_LIBS]) # }}} -# pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{ -$PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null -if test $? -eq 0; then - with_libxml2="yes" -else - with_libxml2="no (pkg-config doesn't know libxml-2.0)" -fi - -$PKG_CONFIG --exists libvirt 2>/dev/null -if test $? = 0; then - with_libvirt="yes" -else - with_libvirt="no (pkg-config doesn't know libvirt)" -fi - -if test "x$with_libxml2" = "xyes"; then - with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`" - if test $? -ne 0; then - with_libxml2="no" - fi - - with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`" - if test $? -ne 0; then - with_libxml2="no" - fi -fi +# --with-libxml2 {{{ +AC_ARG_WITH(libxml2, + [AS_HELP_STRING([--with-libxml2@<:@=PREFIX@:>@], [Path to libxml2.])], + [ + if test "x$withval" = "xno"; then + with_libxml2="no" + else if test "x$withval" = "xyes"; then + $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null + if test $? -eq 0; then + with_libxml2="yes" + with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`" + with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`" + else + with_libxml2="no (pkg-config doesn't know libxml-2.0)" + fi + else + with_libxml2="yes" + with_libxml2_cflags="-I$withval/include" + with_libxml2_ldflags="-L$withval/lib" + fi; fi + ], + dnl if no argument --with-libxml2 was passed, find the library locations + dnl with pkg-config just like above, when --with-libxml2=yes. + [ + with_libxml2="yes" + $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null + if test $? -eq 0; then + with_libxml2="yes" + with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`" + with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`" + else + with_libxml2="no (pkg-config doesn't know libxml-2.0)" + fi + ] +) if test "x$with_libxml2" = "xyes"; then SAVE_CPPFLAGS="$CPPFLAGS" @@ -5897,6 +6039,15 @@ fi AC_SUBST([BUILD_WITH_LIBXML2_CFLAGS]) AC_SUBST([BUILD_WITH_LIBXML2_LIBS]) +# }}} + +# pkg-config --exists libvirt {{{ +$PKG_CONFIG --exists libvirt 2>/dev/null +if test $? = 0; then + with_libvirt="yes" +else + with_libvirt="no (pkg-config doesn't know libvirt)" +fi if test "x$with_libvirt" = "xyes"; then with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`" @@ -6229,6 +6380,7 @@ plugin_nfs="no" plugin_numa="no" plugin_ovs_events="no" plugin_ovs_stats="no" +plugin_pcie_errors="no" plugin_perl="no" plugin_pinba="no" plugin_processes="no" @@ -6250,6 +6402,7 @@ plugin_vmem="no" plugin_vserver="no" plugin_wireless="no" plugin_write_prometheus="no" +plugin_write_stackdriver="no" plugin_xencpu="no" plugin_zfs_arc="no" plugin_zone="no" @@ -6307,6 +6460,10 @@ if test "x$ac_system" = "xLinux"; then plugin_ovs_events="yes" plugin_ovs_stats="yes" fi + + if test "x$have_pci_regs_h" = "xyes"; then + plugin_pcie_errors="yes" + fi fi if test "x$ac_system" = "xOpenBSD"; then @@ -6404,6 +6561,10 @@ if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"; then plugin_curl_json="yes" fi +if test "x$with_libcurl" = "xyes" && test "x$with_libssl" = "xyes" && test "x$with_libyajl" = "xyes" && test "x$with_libyajl2" = "xyes"; then + plugin_write_stackdriver="yes" +fi + if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"; then plugin_curl_xml="yes" fi @@ -6592,162 +6753,164 @@ AC_ARG_ENABLE([all-plugins], m4_divert_once([HELP_ENABLE], []) -AC_PLUGIN([aggregation], [yes], [Aggregation plugin]) -AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin]) -AC_PLUGIN([amqp1], [$with_libqpid_proton], [AMQP 1.0 output plugin]) -AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics]) -AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC]) -AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple hardware sensors]) -AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero hardware sensors]) -AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics]) -AC_PLUGIN([barometer], [$plugin_barometer], [Barometer sensor on I2C]) -AC_PLUGIN([battery], [$plugin_battery], [Battery statistics]) -AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics]) -AC_PLUGIN([ceph], [$plugin_ceph], [Ceph daemon statistics]) -AC_PLUGIN([cgroups], [$plugin_cgroups], [CGroups CPU usage accounting]) -AC_PLUGIN([chrony], [yes], [Chrony statistics]) -AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics]) -AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics]) -AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics]) -AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics]) -AC_PLUGIN([cpusleep], [$plugin_cpusleep], [CPU sleep statistics]) -AC_PLUGIN([csv], [yes], [CSV output plugin]) -AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics]) -AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics]) -AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics]) -AC_PLUGIN([dbi], [$with_libdbi], [General database statistics]) -AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics]) -AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics]) -AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis]) -AC_PLUGIN([dpdkevents], [$plugin_dpdkevents], [Events from DPDK]) -AC_PLUGIN([dpdkstat], [$plugin_dpdkstat], [Stats from DPDK]) -AC_PLUGIN([drbd], [$plugin_drbd], [DRBD statistics]) -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([fhcount], [$plugin_fhcount], [File handles statistics]) -AC_PLUGIN([filecount], [yes], [Count files in directories]) -AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics]) -AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin]) -AC_PLUGIN([gps], [$plugin_gps], [GPS plugin]) -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]) -AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics]) -AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) -AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) -AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) -AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) -AC_PLUGIN([load], [$plugin_load], [System load]) -AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging]) -AC_PLUGIN([logfile], [yes], [File logging plugin]) -AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics]) -AC_PLUGIN([lua], [$with_liblua], [Lua plugin]) -AC_PLUGIN([lvm], [$with_liblvm2app], [LVM statistics]) -AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics]) -AC_PLUGIN([match_empty_counter], [yes], [The empty counter match]) -AC_PLUGIN([match_hashed], [yes], [The hashed match]) -AC_PLUGIN([match_regex], [yes], [The regex match]) -AC_PLUGIN([match_timediff], [yes], [The timediff match]) -AC_PLUGIN([match_value], [yes], [The value match]) -AC_PLUGIN([mbmon], [yes], [Query mbmond]) -AC_PLUGIN([mcelog], [$plugin_mcelog], [Machine Check Exceptions notifications]) -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]) -AC_PLUGIN([mic], [$with_mic], [Intel Many Integrated Core stats]) -AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin]) -AC_PLUGIN([mqtt], [$with_libmosquitto], [MQTT output plugin]) -AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values]) -AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics]) -AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin]) -AC_PLUGIN([netlink], [$with_libmnl], [Enhanced Linux network statistics]) -AC_PLUGIN([network], [yes], [Network communication plugin]) -AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics]) -AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics]) -AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications]) -AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier]) -AC_PLUGIN([notify_nagios], [yes], [Nagios notification plugin]) -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]) -AC_PLUGIN([openldap], [$with_libldap], [OpenLDAP statistics]) -AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics]) -AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin]) -AC_PLUGIN([ovs_events], [$plugin_ovs_events], [OVS events plugin]) -AC_PLUGIN([ovs_stats], [$plugin_ovs_stats], [OVS statistics plugin]) -AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter]) -AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics]) +AC_PLUGIN([aggregation], [yes], [Aggregation plugin]) +AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin]) +AC_PLUGIN([amqp1], [$with_libqpid_proton], [AMQP 1.0 output plugin]) +AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics]) +AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC]) +AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple hardware sensors]) +AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero hardware sensors]) +AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics]) +AC_PLUGIN([barometer], [$plugin_barometer], [Barometer sensor on I2C]) +AC_PLUGIN([battery], [$plugin_battery], [Battery statistics]) +AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics]) +AC_PLUGIN([ceph], [$plugin_ceph], [Ceph daemon statistics]) +AC_PLUGIN([cgroups], [$plugin_cgroups], [CGroups CPU usage accounting]) +AC_PLUGIN([chrony], [yes], [Chrony statistics]) +AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics]) +AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics]) +AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics]) +AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics]) +AC_PLUGIN([cpusleep], [$plugin_cpusleep], [CPU sleep statistics]) +AC_PLUGIN([csv], [yes], [CSV output plugin]) +AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics]) +AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics]) +AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics]) +AC_PLUGIN([dbi], [$with_libdbi], [General database statistics]) +AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics]) +AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics]) +AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis]) +AC_PLUGIN([dpdkevents], [$plugin_dpdkevents], [Events from DPDK]) +AC_PLUGIN([dpdkstat], [$plugin_dpdkstat], [Stats from DPDK]) +AC_PLUGIN([drbd], [$plugin_drbd], [DRBD statistics]) +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([fhcount], [$plugin_fhcount], [File handles statistics]) +AC_PLUGIN([filecount], [yes], [Count files in directories]) +AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics]) +AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin]) +AC_PLUGIN([gps], [$plugin_gps], [GPS plugin]) +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]) +AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics]) +AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) +AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) +AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) +AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) +AC_PLUGIN([load], [$plugin_load], [System load]) +AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging]) +AC_PLUGIN([logfile], [yes], [File logging plugin]) +AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics]) +AC_PLUGIN([lua], [$with_liblua], [Lua plugin]) +AC_PLUGIN([lvm], [$with_liblvm2app], [LVM statistics]) +AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics]) +AC_PLUGIN([match_empty_counter], [yes], [The empty counter match]) +AC_PLUGIN([match_hashed], [yes], [The hashed match]) +AC_PLUGIN([match_regex], [yes], [The regex match]) +AC_PLUGIN([match_timediff], [yes], [The timediff match]) +AC_PLUGIN([match_value], [yes], [The value match]) +AC_PLUGIN([mbmon], [yes], [Query mbmond]) +AC_PLUGIN([mcelog], [$plugin_mcelog], [Machine Check Exceptions notifications]) +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]) +AC_PLUGIN([mic], [$with_mic], [Intel Many Integrated Core stats]) +AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin]) +AC_PLUGIN([mqtt], [$with_libmosquitto], [MQTT output plugin]) +AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values]) +AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics]) +AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin]) +AC_PLUGIN([netlink], [$with_libmnl], [Enhanced Linux network statistics]) +AC_PLUGIN([network], [yes], [Network communication plugin]) +AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics]) +AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics]) +AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications]) +AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier]) +AC_PLUGIN([notify_nagios], [yes], [Nagios notification plugin]) +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]) +AC_PLUGIN([openldap], [$with_libldap], [OpenLDAP statistics]) +AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics]) +AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin]) +AC_PLUGIN([ovs_events], [$plugin_ovs_events], [OVS events plugin]) +AC_PLUGIN([ovs_stats], [$plugin_ovs_stats], [OVS statistics plugin]) +AC_PLUGIN([pcie_errors], [$plugin_pcie_errors], [PCIe errors plugin]) +AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter]) +AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics]) # FIXME: Check for libevent, too. -AC_PLUGIN([pinba], [$plugin_pinba], [Pinba statistics]) -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([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics]) -AC_PLUGIN([python], [$plugin_python], [Embed a Python interpreter]) -AC_PLUGIN([redis], [$with_libhiredis], [Redis plugin]) -AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin]) -AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin]) -AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin]) -AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics]) -AC_PLUGIN([serial], [$plugin_serial], [serial port traffic]) -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([synproxy], [$plugin_synproxy], [Synproxy stats plugin]) -AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin]) -AC_PLUGIN([table], [yes], [Parsing of tabular data]) -AC_PLUGIN([tail], [yes], [Parsing of logfiles]) -AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files]) -AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics]) -AC_PLUGIN([target_notification], [yes], [The notification target]) -AC_PLUGIN([target_replace], [yes], [The replace target]) -AC_PLUGIN([target_scale], [yes], [The scale target]) -AC_PLUGIN([target_set], [yes], [The set target]) -AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target]) -AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics]) -AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics]) -AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values]) -AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics]) -AC_PLUGIN([threshold], [yes], [Threshold checking plugin]) -AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics]) -AC_PLUGIN([turbostat], [$plugin_turbostat], [Advanced statistic on Intel cpu states]) -AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin]) -AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics]) -AC_PLUGIN([users], [$plugin_users], [User statistics]) -AC_PLUGIN([uuid], [yes], [UUID as hostname plugin]) -AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics]) -AC_PLUGIN([virt], [$plugin_virt], [Virtual machine statistics]) -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_kafka], [$with_librdkafka], [Kafka output plugin]) -AC_PLUGIN([write_log], [yes], [Log output plugin]) -AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin]) -AC_PLUGIN([write_prometheus], [$plugin_write_prometheus], [Prometheus write plugin]) -AC_PLUGIN([write_redis], [$with_libhiredis], [Redis output plugin]) -AC_PLUGIN([write_riemann], [$with_libriemann_client], [Riemann output plugin]) -AC_PLUGIN([write_sensu], [yes], [Sensu output plugin]) -AC_PLUGIN([write_tsdb], [yes], [TSDB output plugin]) -AC_PLUGIN([xencpu], [$plugin_xencpu], [Xen Host CPU usage]) -AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics]) -AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics]) -AC_PLUGIN([zone], [$plugin_zone], [Solaris container statistics]) -AC_PLUGIN([zookeeper], [yes], [Zookeeper statistics]) +AC_PLUGIN([pinba], [$plugin_pinba], [Pinba statistics]) +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([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics]) +AC_PLUGIN([python], [$plugin_python], [Embed a Python interpreter]) +AC_PLUGIN([redis], [$with_libhiredis], [Redis plugin]) +AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin]) +AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin]) +AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin]) +AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics]) +AC_PLUGIN([serial], [$plugin_serial], [serial port traffic]) +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([synproxy], [$plugin_synproxy], [Synproxy stats plugin]) +AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin]) +AC_PLUGIN([table], [yes], [Parsing of tabular data]) +AC_PLUGIN([tail], [yes], [Parsing of logfiles]) +AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files]) +AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics]) +AC_PLUGIN([target_notification], [yes], [The notification target]) +AC_PLUGIN([target_replace], [yes], [The replace target]) +AC_PLUGIN([target_scale], [yes], [The scale target]) +AC_PLUGIN([target_set], [yes], [The set target]) +AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target]) +AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics]) +AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics]) +AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values]) +AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics]) +AC_PLUGIN([threshold], [yes], [Threshold checking plugin]) +AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics]) +AC_PLUGIN([turbostat], [$plugin_turbostat], [Advanced statistic on Intel cpu states]) +AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin]) +AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics]) +AC_PLUGIN([users], [$plugin_users], [User statistics]) +AC_PLUGIN([uuid], [yes], [UUID as hostname plugin]) +AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics]) +AC_PLUGIN([virt], [$plugin_virt], [Virtual machine statistics]) +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_stackdriver], [$plugin_write_stackdriver], [Google Stackdriver Monitoring output plugin]) +AC_PLUGIN([write_kafka], [$with_librdkafka], [Kafka output plugin]) +AC_PLUGIN([write_log], [yes], [Log output plugin]) +AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin]) +AC_PLUGIN([write_prometheus], [$plugin_write_prometheus], [Prometheus write plugin]) +AC_PLUGIN([write_redis], [$with_libhiredis], [Redis output plugin]) +AC_PLUGIN([write_riemann], [$with_libriemann_client], [Riemann output plugin]) +AC_PLUGIN([write_sensu], [yes], [Sensu output plugin]) +AC_PLUGIN([write_tsdb], [yes], [TSDB output plugin]) +AC_PLUGIN([xencpu], [$plugin_xencpu], [Xen Host CPU usage]) +AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics]) +AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics]) +AC_PLUGIN([zone], [$plugin_zone], [Solaris container statistics]) +AC_PLUGIN([zookeeper], [yes], [Zookeeper statistics]) dnl Default configuration file # Load either syslog or logfile @@ -6991,6 +7154,7 @@ AC_MSG_RESULT([ librouteros . . . . . $with_librouteros]) AC_MSG_RESULT([ librrd . . . . . . . $with_librrd]) AC_MSG_RESULT([ libsensors . . . . . $with_libsensors]) AC_MSG_RESULT([ libsigrok . . . . . $with_libsigrok]) +AC_MSG_RESULT([ libssl . . . . . . . $with_libssl]) AC_MSG_RESULT([ libstatgrab . . . . . $with_libstatgrab]) AC_MSG_RESULT([ libtokyotyrant . . . $with_libtokyotyrant]) AC_MSG_RESULT([ libudev . . . . . . . $with_libudev]) @@ -7105,6 +7269,7 @@ AC_MSG_RESULT([ openvpn . . . . . . . $enable_openvpn]) AC_MSG_RESULT([ oracle . . . . . . . $enable_oracle]) AC_MSG_RESULT([ ovs_events . . . . . $enable_ovs_events]) AC_MSG_RESULT([ ovs_stats . . . . . . $enable_ovs_stats]) +AC_MSG_RESULT([ pcie_errors . . . . . $enable_pcie_errors]) AC_MSG_RESULT([ perl . . . . . . . . $enable_perl]) AC_MSG_RESULT([ pf . . . . . . . . . $enable_pf]) AC_MSG_RESULT([ pinba . . . . . . . . $enable_pinba]) @@ -7162,6 +7327,7 @@ AC_MSG_RESULT([ write_prometheus. . . $enable_write_prometheus]) AC_MSG_RESULT([ write_redis . . . . . $enable_write_redis]) AC_MSG_RESULT([ write_riemann . . . . $enable_write_riemann]) AC_MSG_RESULT([ write_sensu . . . . . $enable_write_sensu]) +AC_MSG_RESULT([ write_stackdriver . . $enable_write_stackdriver]) AC_MSG_RESULT([ write_tsdb . . . . . $enable_write_tsdb]) AC_MSG_RESULT([ xencpu . . . . . . . $enable_xencpu]) AC_MSG_RESULT([ xmms . . . . . . . . $enable_xmms]) @@ -7179,3 +7345,4 @@ if test "x$dependency_warning" = "xyes"; then fi # vim: set fdm=marker sw=2 sts=2 ts=2 et : + diff --git a/contrib/docker/rootfs_prefix/rootfs_prefix.c b/contrib/docker/rootfs_prefix/rootfs_prefix.c index 2b831518..fdacf743 100644 --- a/contrib/docker/rootfs_prefix/rootfs_prefix.c +++ b/contrib/docker/rootfs_prefix/rootfs_prefix.c @@ -1,3 +1,33 @@ +/** + * collectd - contrib/docker/rootfs_prefix/rootfs_prefix.c + * Copyright (C) 2016-2018 Marc Fournier + * Copyright (C) 2016-2018 Ruben Kerkhof + * + * MIT License: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Marc Fournier + * Ruben Kerkhof + **/ + #define _GNU_SOURCE #include diff --git a/gnulib b/gnulib new file mode 160000 index 00000000..2f8140bc --- /dev/null +++ b/gnulib @@ -0,0 +1 @@ +Subproject commit 2f8140bc8ce5501e31dcc665b42b5df64f84c20c diff --git a/src/amqp1.c b/src/amqp1.c index 635af0f7..87bb50cf 100644 --- a/src/amqp1.c +++ b/src/amqp1.c @@ -372,7 +372,7 @@ static int amqp1_notify(notification_t const *n, } cd_message_t *cdm = malloc(sizeof(*cdm)); - if (cdm == NULL ){ + if (cdm == NULL) { ERROR("amqp1 plugin: notify failed"); return -1; } @@ -471,15 +471,16 @@ static int amqp1_write(const data_set_t *ds, const value_list_t *vl, /* {{{ */ format_json_initialize((char *)cdm->mbuf.start, &bfill, &bfree); format_json_value_list((char *)cdm->mbuf.start, &bfill, &bfree, ds, vl, instance->store_rates); - status= format_json_finalize((char *)cdm->mbuf.start, &bfill, &bfree); + status = format_json_finalize((char *)cdm->mbuf.start, &bfill, &bfree); if (status != 0) { - ERROR("amqp1 plugin: format_json_finalize failed with status %i.", status); + ERROR("amqp1 plugin: format_json_finalize failed with status %i.", + status); cd_message_free(cdm); - return(status); + return status; } cdm->mbuf.size = strlen(cdm->mbuf.start); if (cdm->mbuf.size >= BUFSIZE) { - ERROR("amqp1 plugin: format graphite failed"); + ERROR("amqp1 plugin: format json failed"); cd_message_free(cdm); return -1; } diff --git a/src/bind.c b/src/bind.c index 3a5e3c31..fe3480d0 100644 --- a/src/bind.c +++ b/src/bind.c @@ -73,9 +73,9 @@ typedef int (*list_callback_t)(const char *name, value_t value, struct cb_view_s { char *name; - int qtypes; - int resolver_stats; - int cacherrsets; + _Bool qtypes; + _Bool resolver_stats; + _Bool cacherrsets; char **zones; size_t zones_num; @@ -107,12 +107,12 @@ typedef struct list_info_ptr_s list_info_ptr_t; static bool config_parse_time = true; static char *url; -static int global_opcodes = 1; -static int global_qtypes = 1; -static int global_server_stats = 1; -static int global_zone_maint_stats = 1; -static int global_resolver_stats; -static int global_memory_stats = 1; +static _Bool global_opcodes = 1; +static _Bool global_qtypes = 1; +static _Bool global_server_stats = 1; +static _Bool global_zone_maint_stats = 1; +static _Bool global_resolver_stats; +static _Bool global_memory_stats = 1; static int timeout = -1; static cb_view_t *views; @@ -343,8 +343,6 @@ static int bind_xml_read_derive(xmlDoc *doc, xmlNode *node, /* {{{ */ int status = parse_value(str_ptr, &value, DS_TYPE_DERIVE); if (status != 0) { - ERROR("bind plugin: Parsing string \"%s\" to derive value failed.", - str_ptr); xmlFree(str_ptr); return -1; } @@ -1410,22 +1408,6 @@ static int bind_xml(const char *data) /* {{{ */ return ret; } /* }}} int bind_xml */ -static int bind_config_set_bool(const char *name, int *var, /* {{{ */ - oconfig_item_t *ci) { - if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN)) { - WARNING("bind plugin: The `%s' option needs " - "exactly one boolean argument.", - name); - return -1; - } - - if (ci->values[0].value.boolean) - *var = 1; - else - *var = 0; - return 0; -} /* }}} int bind_config_set_bool */ - static int bind_config_add_view_zone(cb_view_t *view, /* {{{ */ oconfig_item_t *ci) { if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) { @@ -1484,11 +1466,11 @@ static int bind_config_add_view(oconfig_item_t *ci) /* {{{ */ oconfig_item_t *child = ci->children + i; if (strcasecmp("QTypes", child->key) == 0) - bind_config_set_bool("QTypes", &tmp->qtypes, child); + cf_util_get_boolean(child, &tmp->qtypes); else if (strcasecmp("ResolverStats", child->key) == 0) - bind_config_set_bool("ResolverStats", &tmp->resolver_stats, child); + cf_util_get_boolean(child, &tmp->resolver_stats); else if (strcasecmp("CacheRRSets", child->key) == 0) - bind_config_set_bool("CacheRRSets", &tmp->cacherrsets, child); + cf_util_get_boolean(child, &tmp->cacherrsets); else if (strcasecmp("Zone", child->key) == 0) bind_config_add_view_zone(tmp, child); else { @@ -1508,27 +1490,19 @@ static int bind_config(oconfig_item_t *ci) /* {{{ */ oconfig_item_t *child = ci->children + i; if (strcasecmp("Url", child->key) == 0) { - if ((child->values_num != 1) || - (child->values[0].type != OCONFIG_TYPE_STRING)) { - WARNING("bind plugin: The `Url' option needs " - "exactly one string argument."); - return -1; - } - - sfree(url); - url = strdup(child->values[0].value.string); + cf_util_get_string(child, &url); } else if (strcasecmp("OpCodes", child->key) == 0) - bind_config_set_bool("OpCodes", &global_opcodes, child); + cf_util_get_boolean(child, &global_opcodes); else if (strcasecmp("QTypes", child->key) == 0) - bind_config_set_bool("QTypes", &global_qtypes, child); + cf_util_get_boolean(child, &global_qtypes); else if (strcasecmp("ServerStats", child->key) == 0) - bind_config_set_bool("ServerStats", &global_server_stats, child); + cf_util_get_boolean(child, &global_server_stats); else if (strcasecmp("ZoneMaintStats", child->key) == 0) - bind_config_set_bool("ZoneMaintStats", &global_zone_maint_stats, child); + cf_util_get_boolean(child, &global_zone_maint_stats); else if (strcasecmp("ResolverStats", child->key) == 0) - bind_config_set_bool("ResolverStats", &global_resolver_stats, child); + cf_util_get_boolean(child, &global_resolver_stats); else if (strcasecmp("MemoryStats", child->key) == 0) - bind_config_set_bool("MemoryStats", &global_memory_stats, child); + cf_util_get_boolean(child, &global_memory_stats); else if (strcasecmp("View", child->key) == 0) bind_config_add_view(child); else if (strcasecmp("ParseTime", child->key) == 0) diff --git a/src/ceph.c b/src/ceph.c index 92cfff6e..c7fc576a 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -1142,8 +1142,8 @@ static int cconn_validate_revents(struct cconn *io, int revents) { } /** Handle a network event for a connection */ -static int cconn_handle_event(struct cconn *io) { - int ret; +static ssize_t cconn_handle_event(struct cconn *io) { + ssize_t ret; switch (io->state) { case CSTATE_UNCONNECTED: ERROR("ceph plugin: cconn_handle_event(name=%s) got to illegal " @@ -1158,7 +1158,7 @@ static int cconn_handle_event(struct cconn *io) { size_t cmd_len = strlen(cmd); RETRY_ON_EINTR( ret, write(io->asok, ((char *)&cmd) + io->amt, cmd_len - io->amt)); - DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,amt=%d,ret=%d)", + DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,amt=%d,ret=%zd)", io->d->name, io->state, io->amt, ret); if (ret < 0) { return ret; @@ -1180,7 +1180,7 @@ static int cconn_handle_event(struct cconn *io) { case CSTATE_READ_VERSION: { RETRY_ON_EINTR(ret, read(io->asok, ((char *)(&io->d->version)) + io->amt, sizeof(io->d->version) - io->amt)); - DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%d)", + DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%zd)", io->d->name, io->state, ret); if (ret < 0) { return ret; @@ -1206,7 +1206,7 @@ static int cconn_handle_event(struct cconn *io) { case CSTATE_READ_AMT: { RETRY_ON_EINTR(ret, read(io->asok, ((char *)(&io->json_len)) + io->amt, sizeof(io->json_len) - io->amt)); - DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%d)", + DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%zd)", io->d->name, io->state, ret); if (ret < 0) { return ret; @@ -1227,7 +1227,7 @@ static int cconn_handle_event(struct cconn *io) { case CSTATE_READ_JSON: { RETRY_ON_EINTR(ret, read(io->asok, io->json + io->amt, io->json_len - io->amt)); - DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%d)", + DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%zd)", io->d->name, io->state, ret); if (ret < 0) { return ret; @@ -1296,8 +1296,8 @@ static int cconn_prepare(struct cconn *io, struct pollfd *fds) { */ static int milli_diff(const struct timeval *t1, const struct timeval *t2) { int64_t ret; - int sec_diff = t1->tv_sec - t2->tv_sec; - int usec_diff = t1->tv_usec - t2->tv_usec; + long sec_diff = t1->tv_sec - t2->tv_sec; + long usec_diff = t1->tv_usec - t2->tv_usec; ret = usec_diff / 1000; ret += (sec_diff * 1000); return (ret > INT_MAX) ? INT_MAX : ((ret < INT_MIN) ? INT_MIN : (int)ret); @@ -1305,8 +1305,9 @@ static int milli_diff(const struct timeval *t1, const struct timeval *t2) { /** This handles the actual network I/O to talk to the Ceph daemons. */ -static int cconn_main_loop(uint32_t request_type) { - int ret, some_unreachable = 0; +static ssize_t cconn_main_loop(uint32_t request_type) { + int some_unreachable = 0; + ssize_t ret; struct timeval end_tv; struct cconn io_array[g_num_daemons]; @@ -1343,7 +1344,7 @@ static int cconn_main_loop(uint32_t request_type) { struct cconn *io = io_array + i; ret = cconn_prepare(io, fds + nfds); if (ret < 0) { - WARNING("ceph plugin: cconn_prepare(name=%s,i=%" PRIsz ",st=%d)=%d", + WARNING("ceph plugin: cconn_prepare(name=%s,i=%" PRIsz ",st=%d)=%zd", io->d->name, i, io->state, ret); cconn_close(io); io->request_type = ASOK_REQ_NONE; @@ -1367,7 +1368,7 @@ static int cconn_main_loop(uint32_t request_type) { } RETRY_ON_EINTR(ret, poll(fds, nfds, diff)); if (ret < 0) { - ERROR("ceph plugin: poll(2) error: %d", ret); + ERROR("ceph plugin: poll(2) error: %zd", ret); goto done; } for (int i = 0; i < nfds; ++i) { @@ -1388,7 +1389,7 @@ static int cconn_main_loop(uint32_t request_type) { ret = cconn_handle_event(io); if (ret) { WARNING("ceph plugin: cconn_handle_event(name=%s," - "i=%d,st=%d): error %d", + "i=%d,st=%d): error %zd", io->d->name, i, io->state, ret); cconn_close(io); io->request_type = ASOK_REQ_NONE; @@ -1409,7 +1410,7 @@ done: return ret; } -static int ceph_read(void) { return cconn_main_loop(ASOK_REQ_DATA); } +static int ceph_read(void) { return (int)cconn_main_loop(ASOK_REQ_DATA); } /******* lifecycle *******/ static int ceph_init(void) { @@ -1436,7 +1437,7 @@ static int ceph_init(void) { return ENOENT; } - return cconn_main_loop(ASOK_REQ_VERSION); + return (int)cconn_main_loop(ASOK_REQ_VERSION); } static int ceph_shutdown(void) { diff --git a/src/chrony.c b/src/chrony.c index 6fb369a2..913aab94 100644 --- a/src/chrony.c +++ b/src/chrony.c @@ -38,6 +38,11 @@ #include /* ntohs/ntohl */ #endif +/* AIX doesn't have MSG_DONTWAIT */ +#ifndef MSG_DONTWAIT +#define MSG_DONTWAIT MSG_NONBLOCK +#endif + #define CONFIG_KEY_HOST "Host" #define CONFIG_KEY_PORT "Port" #define CONFIG_KEY_TIMEOUT "Timeout" @@ -440,6 +445,15 @@ static int chrony_recv_response(tChrony_Response *p_resp, } } +static void chrony_flush_recv_queue(void) { + char buf[1]; + + if (g_chrony_is_connected) { + while (recv(g_chrony_socket, buf, sizeof(buf), MSG_DONTWAIT) > 0) + ; + } +} + static int chrony_query(const int p_command, tChrony_Request *p_req, tChrony_Response *p_resp, size_t *p_resp_size) { /* Check connection. We simply perform one try as collectd already handles @@ -964,6 +978,9 @@ static int chrony_read(void) { g_chrony_seq_is_initialized = 1; } + /* Ignore late responses that may have been received */ + chrony_flush_recv_queue(); + /* Get daemon stats */ rc = chrony_request_daemon_stats(); if (rc != CHRONY_RC_OK) diff --git a/src/collectd-snmp.pod b/src/collectd-snmp.pod index d615088e..9d508d17 100644 --- a/src/collectd-snmp.pod +++ b/src/collectd-snmp.pod @@ -10,23 +10,24 @@ collectd-snmp - Documentation of collectd's C # ... - Type "voltage" Table false - Instance "input_line1" + Type "voltage" + TypeInstance "input_line1" Scale 0.1 Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1" - Type "users" Table false - Instance "" + Type "users" Shift -1 Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0" - Type "if_octets" Table true - Instance "IF-MIB::ifDescr" + Type "if_octets" + TypeInstanceOID "IF-MIB::ifDescr" + #FilterOID "IF-MIB::ifOperStatus" + #FilterValues "1", "2" Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets" @@ -114,8 +115,9 @@ queried using the C SNMP command (see L) and transmitted to collectd. B value list is dispatched and, eventually, one file will be written. -When B is set to B, the OIDs given to B (see below) are -queried using the C SNMP command until the subtree is left. After all +When B
is set to B, the OIDs given to B, B, +B, B and B (see below) are queried using +the C SNMP command until the subtree is left. After all the lists (think: all columns of the table) have been read B values sets will be dispatches and, eventually, several files will be written. If you configure a B (see above) which needs more than one data source (for @@ -138,33 +140,66 @@ C and C. But, this is because of the B setting, not the B
setting. Since the semantic of B and B depends on this setting you -need to set it before setting them. Doing vice verse will result in undefined +need to set it before setting them. Doing vice versa will result in undefined behavior. -=item B I +=item B I -Sets the type-instance of the values that are dispatched. The meaning of this -setting depends on whether B
is set to I or I: +Use I as the plugin name of the values that are dispatched. +Defaults to C. -If B
is set to I, I is interpreted as an SNMP-prefix -that will return a list of values. Those values are then used as the actual -type-instance. An example would be the C subtree. -L from the SNMP distribution describes the format of OIDs. +=item B I -If B
is set to I and B is omitted, then "SUBID" will be -used as the instance. +Sets the plugin-instance of the values that are dispatched to I value. -If B
is set to I the actual string configured for I is -copied into the value-list. In this case I may be empty, i.Ee. -"". +When B
is set to I and B is set then this option +has no effect. -=item B I +Defaults to an empty string. + +=item B I + +Sets the type-instance of the values that are dispatched to I value. -If B
is set to I, you may feel the need to add something to the -instance of the files. If set, I is prepended to the instance as -determined by querying the agent. When B
is set to I this option +When B
is set to I and B is set then this option has no effect. +Defaults to an empty string. + +=item B I + +=item B I + +=item B I + +If B
is set to I, I is interpreted as an SNMP-prefix that will +return a list of values. Those values are then used as the actual type-instance, +plugin-instance or host of dispatched metrics. An example would be the +C subtree. L from the SNMP distribution describes +the format of OIDs. When option is set to empty string, then "SUBID" will be used +as the value. + +Prefix may be set for values with use of appropriate B, +B and B options. + +When B
is set to I these options has no effect. + +Defaults: When no one of these options is configured explicitly, +B defaults to an empty string. + +=item B + +=item B + +=item B + +These options are intented to be used together with B, +B and B respectively. + +If set, I is preprended to values received by querying the agent. + +When B
is set to I these options has no effect. + The C is an example where you need this setting: It has voltages of the inlets, outlets and the battery of an UPS. However, it doesn't provide a descriptive column for these voltages. In this case having 1, 2,E... as @@ -172,6 +207,25 @@ instances is not enough, because the inlet voltages and outlet voltages may both have the subids 1, 2,E... You can use this setting to distinguish between the different voltages. +=item B I + +Attention: this option exists for backwards compatibility only and will be +removed in next major release. Please use B / B +instead. + +The meaning of this setting depends on whether B
is set to I or +I. + +If B
is set to I, option behaves as B. +If B
is set to I, option behaves as B. + +Note what B
option must be set before setting B. + +=item B I + +Attention: this option exists for backwards compatibility only and will be +removed in next major release. Please use B instead. + =item B I [I ...] Configures the values to be queried from the SNMP host. The meaning slightly @@ -208,16 +262,39 @@ This value is not applied to counter-values. =item B I [, I ...] -The ignore values allows one to ignore Instances based on their name and the -patterns specified by the various values you've entered. The match is a +The ignore values allows one to ignore TypeInstances based on their name and +the patterns specified by the various values you've entered. The match is a glob-type shell matching. +When B
is set to I then this option has no effect. + =item B I The invertmatch value should be use in combination of the Ignore option. It changes the behaviour of the Ignore option, from a blacklist behaviour when InvertMatch is set to false, to a whitelist when specified to true. +=item B I + +=item B I [, I ...] + +=item B I + +When B
is set to I, these options allow to configure filtering +based on MIB values. + +The B declares I to fill table column with values. +The B declares values list to do match. Whether table row will be +collected or ignored depends on the B setting. +As with other plugins that use the daemon's ignorelist functionality, a string +that starts and ends with a slash is interpreted as a regular expression. + +If no selection is configured at all, B table rows are selected. + +When B
is set to I then these options has no effect. + +See B
and F for details. + =back =head2 The Host block diff --git a/src/collectd-tg.c b/src/collectd-tg.c index 4669c655..2d83bbfe 100644 --- a/src/collectd-tg.c +++ b/src/collectd-tg.c @@ -105,7 +105,7 @@ static double dtime(void) /* {{{ */ { struct timespec ts = {0}; - if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) + if (clock_gettime(CLOCK_REALTIME, &ts) != 0) perror("clock_gettime"); return (double)ts.tv_sec + (double)ts.tv_nsec / 1e9; diff --git a/src/collectd.conf.in b/src/collectd.conf.in index c2aa9152..94214759 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -173,6 +173,7 @@ #@BUILD_PLUGIN_ORACLE_TRUE@LoadPlugin oracle #@BUILD_PLUGIN_OVS_EVENTS_TRUE@LoadPlugin ovs_events #@BUILD_PLUGIN_OVS_STATS_TRUE@LoadPlugin ovs_stats +#@BUILD_PLUGIN_PCIE_ERRORS_TRUE@LoadPlugin pcie_errors #@BUILD_PLUGIN_PERL_TRUE@LoadPlugin perl #@BUILD_PLUGIN_PINBA_TRUE@LoadPlugin pinba #@BUILD_PLUGIN_PING_TRUE@LoadPlugin ping @@ -221,6 +222,7 @@ #@BUILD_PLUGIN_WRITE_REDIS_TRUE@LoadPlugin write_redis #@BUILD_PLUGIN_WRITE_RIEMANN_TRUE@LoadPlugin write_riemann #@BUILD_PLUGIN_WRITE_SENSU_TRUE@LoadPlugin write_sensu +#@BUILD_PLUGIN_WRITE_STACKDRIVER_TRUE@LoadPlugin write_stackdriver #@BUILD_PLUGIN_WRITE_TSDB_TRUE@LoadPlugin write_tsdb #@BUILD_PLUGIN_XENCPU_TRUE@LoadPlugin xencpu #@BUILD_PLUGIN_XMMS_TRUE@LoadPlugin xmms @@ -1130,6 +1132,12 @@ # Bridges "br0" "br_ext" # +# +# Source "sysfs" +# ReportMasked false +# PersistentNotifications false +# + # # IncludeDir "/my/include/path" # BaseName "Collectd::Plugins" @@ -1269,6 +1277,7 @@ # # Host "redis.example.com" # Port "6379" +# #Socket "/var/run/redis/redis.sock" # Timeout 2000 # # #Database 0 @@ -1290,6 +1299,7 @@ # CollectMemory true # CollectDF true # CollectDisk true +# CollectHealth true # # @@ -1337,21 +1347,31 @@ # # -# Type "voltage" # Table false -# Instance "input_line1" +# Type "voltage" +# TypeInstance "input_line1" # Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1" # # -# Type "users" # Table false -# Instance "" +# Type "users" +# TypeInstance "" # Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0" # # +# Table true # Type "if_octets" +# TypeInstanceOID "IF-MIB::ifDescr" +# #TypeInstancePrefix "port" +# Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets" +# #FilterOID "IF-MIB::ifOperStatus" +# #FilterValues "1", "2" +# +# # Table true -# Instance "IF-MIB::ifDescr" +# Type "if_octets" +# Plugin "interface" +# PluginInstanceOID "IF-MIB::ifDescr" # Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets" # # @@ -1392,7 +1412,9 @@ # IndexOID "IF-MIB::ifIndex" # SizeOID "IF-MIB::ifNumber" # -# Instance true +# +# Source "PluginInstance" +# # Plugin "interface" # OIDs "IF-MIB::ifDescr" # @@ -1766,6 +1788,16 @@ # Attribute "foo" "bar" # +# +# Project "stackdriver-account" +# CredentialFile "/path/to/gcp-project-id-12345.json" +# Email "123456789012@developer.gserviceaccount.com" +# +# Label "project_id" "gcp-project-id" +# +# Url "https://monitoring.googleapis.com/v3" +# + # # # Host "localhost" diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 69a1b1e0..e11e514f 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -1908,6 +1908,11 @@ plugin below on how matches are defined. If the B or B options are set to B, B blocks are optional. +=item B I + +Sets the interval (in seconds) in which the values will be collected from this +URL. By default the global B setting will be used. + =item B I The B option sets the overall timeout for HTTP requests to B, in @@ -2104,6 +2109,11 @@ Use I as the plugin instance when submitting values. May be overridden by B option inside B blocks. Defaults to an empty string (no plugin instance). +=item B I + +Sets the interval (in seconds) in which the values will be collected from this +URL. By default the global B setting will be used. + =item B I I If an XPath expression references namespaces, they must be specified @@ -5438,6 +5448,12 @@ behavior is to let the kernel choose the appropriate interface. Be warned that the manual selection of an interface for unicast traffic is only necessary in rare cases. +=item B I + +Set the outgoing IP address for IP packets. This option can be used instead of +the I option to explicitly define the IP address which will be used +to send Packets to the remote server. + =item B I Sets the interval at which to re-resolve the DNS for the I. This is @@ -6265,6 +6281,52 @@ Default: empty (monitor all bridges) =back +=head2 Plugin C + +The I plugin collects PCI Express errors from Device Status in Capability +structure and from Advanced Error Reporting Extended Capability where available. +At every read it polls config space of PCI Express devices and dispatches +notification for every error that is set. It checks for new errors at every read. +The device is indicated in plugin_instance according to format "domain:bus:dev.fn". +Errors are divided into categories indicated by type_instance: "correctable", and +for uncorrectable errors "non_fatal" or "fatal". +Fatal errors are reported as I and all others as I. + +B + + + Source "sysfs" + AccessDir "/sys/bus/pci" + ReportMasked false + PersistentNotifications false + + +B + +=over 4 + +=item B B|B + +Use B or B to read data from /sysfs or /proc. +The default value is B. + +=item B I + +Directory used to access device config space. It is optional and defaults to +/sys/bus/pci for B and to /proc/bus/pci for B. + +=item B B|B + +If true plugin will notify about errors that are set to masked in Error Mask register. +Such errors are not reported to the PCI Express Root Complex. Defaults to B. + +=item B B|B + +If false plugin will dispatch notification only on set/clear of error. +The ones already reported will be ignored. Defaults to B. + +=back + =head2 Plugin C This plugin embeds a Perl-interpreter into collectd and provides an interface @@ -7217,6 +7279,7 @@ multiple routers: CollectRegistrationTable true CollectDF true CollectDisk true + CollectHealth true @@ -7277,30 +7340,37 @@ Defaults to B. When enabled, the number of sectors written and bad blocks will be collected. Defaults to B. +=item B B|B + +When enabled, the health statistics will be collected. This includes the +voltage and temperature on supported hardware. +Defaults to B. + =back =head2 Plugin C -The I connects to one or more Redis servers and gathers -information about each server's state. For each server there is a I block -which configures the connection parameters for this node. +The I connects to one or more Redis servers, gathers +information about each server's state and executes user-defined queries. +For each server there is a I block which configures the connection +parameters and set of user-defined queries for this node. Host "localhost" Port "6379" + #Socket "/var/run/redis/redis.sock" Timeout 2000 + ReportCommandStats false + ReportCpuUsage true #Database 0 Type "queue_length" Instance "myqueue" - + -The information shown in the synopsis above is the I -which is used by the plugin if no configuration is present. - =over 4 =item B I @@ -7308,7 +7378,9 @@ which is used by the plugin if no configuration is present. The B block identifies a new Redis node, that is a new Redis instance running in an specified host and port. The name for node is a canonical identifier which is used as I. It is limited to -64Echaracters in length. +128Echaracters in length. + +When no B is configured explicitly, plugin connects to "localhost:6379". =item B I @@ -7321,6 +7393,11 @@ The B option is the TCP port on which the Redis instance accepts connections. Either a service name of a port number may be given. Please note that numerical port numbers must be given as a string, too. +=item B I + +Connect to Redis using the UNIX domain socket at I. If this +setting is given, the B and B settings are ignored. + =item B I Use I to authenticate when connecting to I. @@ -7328,30 +7405,47 @@ Use I to authenticate when connecting to I. =item B I The B option set the socket timeout for node response. Since the Redis -read function is blocking, you should keep this value as low as possible. Keep -in mind that the sum of all B values for all B should be lower -than B defined globally. +read function is blocking, you should keep this value as low as possible. +It is expected what B values should be lower than B defined +globally. -=item B I +Defaults to 2000 (2 seconds). -The B block identifies a query to execute against the redis server. -There may be an arbitrary number of queries to execute. +=item B B|B -=item B I +Enables or disables reporting of statistics based on the command type, including +rate of command calls and average CPU time consumed by command processing. +Defaults to B. -This index selects the Redis logical database to use for query. Defaults -to C<0>. +=item B B|B + +Enables or disables reporting of CPU consumption statistics. +Defaults to B. + +=item B I + +The B block identifies a query to execute against the redis server. +There may be an arbitrary number of queries to execute. Each query should +return single string or integer. =item B I -Within a query definition, a valid collectd type to use as when submitting +Within a query definition, a valid I to use as when submitting the result of the query. When not supplied, will default to B. +Currently only types with one datasource are supported. +See L for more details on types and their configuration. + =item B I Within a query definition, an optional type instance to use when submitting the result of the query. When not supplied will default to the escaped -command, up to 64 chars. +command, up to 128 chars. + +=item B I + +This index selects the Redis logical database to use for query. Defaults +to C<0>. =back @@ -7791,7 +7885,9 @@ B IndexOID "IF-MIB::ifIndex" SizeOID "IF-MIB::ifNumber" - Instance true + + Source "PluginInstance" + Plugin "interface" OIDs "IF-MIB::ifDescr" @@ -7802,12 +7898,44 @@ B OIDs "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
+ + + + Source "PluginInstance" + + Plugin "virt" + OIDs "LIBVIRT-HYPERVISOR-MIB::lvhAffinityDomainName" + + + Plugin "virt" + + Source "TypeInstance" + Regex "^vcpu_([0-9]{1,3})-cpu_[0-9]{1,3}$" + Group 1 + + OIDs "LIBVIRT-HYPERVISOR-MIB::lvhVCPUIndex" + + + Plugin "virt" + + Source "TypeInstance" + Regex "^vcpu_[0-9]{1,3}-cpu_([0-9]{1,3})$" + Group 1 + + OIDs "LIBVIRT-HYPERVISOR-MIB::lvhCPUIndex" + + + Plugin "virt" + Type "cpu_affinity" + OIDs "LIBVIRT-HYPERVISOR-MIB::lvhCPUAffinity" + +
There are two types of blocks that can be contained in the CPluginE snmp_agentE> block: B and B: -=head3 The B block +=head3 B block The B block defines a list OIDs that are to be handled. This block can define scalar or table OIDs. If B block is defined inside of B
@@ -7816,11 +7944,34 @@ The following options can be set: =over 4 -=item B I +=item B block -When B is set to B, the value for requested OID is copied from -plugin instance field of corresponding collectd value. If B block defines -scalar data type B has no effect and can be omitted. +B block contains all data needed for proper index build of snmp table. +In case more than +one table B block has B block present then multiple key index is +built. If B block defines scalar data type B has no effect and can +be omitted. + +=over 8 + +=item B I + +B can be set to one of the following values: "Hostname", "Plugin", +"PluginInstance", "Type", "TypeInstance". This value indicates which field of +corresponding collectd metric is taken as a SNMP table index. + +=item B I + +B option can also be used to parse strings or numbers out of +specific field. For example: type-instance field which is "vcpu1-cpu2" can be +parsed into two numeric fields CPU = 2 and VCPU = 1 and can be later used +as a table index. + +=item B I + +B number can be specified in case groups are used in regex. + +=back =item B I @@ -8357,13 +8508,14 @@ B Type "percent" Instance "dropped" - Index 1 + ValueFrom 1 Plugin "snortstats" Instance "eth0" Interval 600 Collect "snort-dropped" + #TimeFrom 0 @@ -8954,6 +9106,40 @@ only on the host system. Only I is required. +Consider the following example config: + + + Connection "qemu:///system" + HostnameFormat "hostname" + InterfaceFormat "address" + PluginInstanceFormat "name" + + +It will generate the following values: + + node42.example.com/virt-instance-0006f26c/disk_octets-vda + node42.example.com/virt-instance-0006f26c/disk_ops-vda + node42.example.com/virt-instance-0006f26c/if_dropped-ca:fe:ca:fe:ca:fe + node42.example.com/virt-instance-0006f26c/if_errors-ca:fe:ca:fe:ca:fe + node42.example.com/virt-instance-0006f26c/if_octets-ca:fe:ca:fe:ca:fe + node42.example.com/virt-instance-0006f26c/if_packets-ca:fe:ca:fe:ca:fe + node42.example.com/virt-instance-0006f26c/memory-actual_balloon + node42.example.com/virt-instance-0006f26c/memory-available + node42.example.com/virt-instance-0006f26c/memory-last_update + node42.example.com/virt-instance-0006f26c/memory-major_fault + node42.example.com/virt-instance-0006f26c/memory-minor_fault + node42.example.com/virt-instance-0006f26c/memory-rss + node42.example.com/virt-instance-0006f26c/memory-swap_in + node42.example.com/virt-instance-0006f26c/memory-swap_out + node42.example.com/virt-instance-0006f26c/memory-total + node42.example.com/virt-instance-0006f26c/memory-unused + node42.example.com/virt-instance-0006f26c/memory-usable + node42.example.com/virt-instance-0006f26c/virt_cpu_total + node42.example.com/virt-instance-0006f26c/virt_vcpu-0 + +You can get information on the metric's units from the online libvirt documentation. +For instance, I is in nanoseconds. + =over 4 =item B I @@ -9056,7 +9242,8 @@ B means use the guest's UUID. This is useful if you want to track the same guest across migrations. B means to use the global B setting, which is probably not -useful on its own because all guests will appear to have the same name. +useful on its own because all guests will appear to have the same name. This is +useful in conjunction with B though. You can also specify combinations of these fields. For example B means to concatenate the guest name and UUID (with a literal colon character @@ -9202,6 +9389,7 @@ Synopsis: Protocol "tcp" LogSendErrors true Prefix "collectd" + UseTags false @@ -9239,13 +9427,20 @@ approach and logging errors fills syslog with unneeded messages. =item B I -When set, I is added in front of the host name. Dots and whitespace are -I escaped in this string (see B below). +When B is I, B value is added in front of the host name. +When B is I, B value is added in front of series name. + +Dots and whitespace are I escaped in this string (see B +below). =item B I -When set, I is appended to the host name. Dots and whitespace are -I escaped in this string (see B below). +When B is I, B value appended to the host name. +When B is I, B value appended to the end of series name +(before the first ; that separates the name from the tags). + +Dots and whitespace are I escaped in this string (see B +below). =item B I @@ -9267,6 +9462,8 @@ path component, for example C. If set to B (the default), the plugin and plugin instance (and likewise the type and type instance) are put into one component, for example C. +Option value is not used when B is I. + =item B B|B If set to B, append the name of the I (DS) to the "metric" @@ -9279,12 +9476,31 @@ If set to B (the default) the C<.> (dot) character is replaced with I. Otherwise, if set to B, the C<.> (dot) character is preserved, i.e. passed through. +Option value is not used when B is I. + =item B B|B If set to B, detect and remove duplicate components in Graphite metric names. For example, the metric name C will be shortened to C. +=item B B|B + +If set to B, Graphite metric names will be generated as tagged series. +This allows for much more flexibility than the traditional hierarchical layout. + +Example: +C + +You can use B option to add more tags by specifying it like +C<;tag1=value1;tag2=value2>. Note what tagging support was added since Graphite +version 1.1.x. + +If set to B, the B and B settings +are not used. + +Default value: B. + =back =head2 Plugin C @@ -9710,17 +9926,26 @@ been set to B. =item B (B=I only) A prefix can be added in the metric name when outputting in the I -format. It's added before the I name. +format. + +When B is I, prefix is added before the I name. Metric name will be CprefixEEhostEEpostfixEEpluginEEtypeEEnameE> +When B is I, prefix is added in front of series name. + =item B (B=I only) A postfix can be added in the metric name when outputting in the I -format. It's added after the I name. +format. + +When B is I, postfix is added after the I name. Metric name will be CprefixEEhostEEpostfixEEpluginEEtypeEEnameE> +When B is I, prefix value appended to the end of series +name (before the first ; that separates the name from the tags). + =item B (B=I only) Specify a character to replace dots (.) in the host part of the metric name. @@ -9735,6 +9960,8 @@ path component, for example C. If set to B (the default), the plugin and plugin instance (and likewise the type and type instance) are put into one component, for example C. +Option value is not used when B is I. + =item B B|B If set to B, append the name of the I (DS) to the "metric" @@ -9747,6 +9974,14 @@ If set to B (the default) the C<.> (dot) character is replaced with I. Otherwise, if set to B, the C<.> (dot) character is preserved, i.e. passed through. +Option value is not used when B is I. + +=item B B|B + +If set to B Graphite metric names will be generated as tagged series. + +Default value: B. + =item B B|B If set to B (the default), convert counter values to rates. If set to @@ -10107,6 +10342,133 @@ attribute for each metric being sent out to I. =back +=head2 Plugin C + +The C plugin writes metrics to the +I service. + +This plugin supports two authentication methods: When configured, credentials +are read from the JSON credentials file specified with B. +Alternatively, when running on +I (GCE), an I token is retrieved from the +I and used to authenticate to GCM. + +B + + + CredentialFile "/path/to/service_account.json" + + Label "project_id" "monitored_project" + + + +=over 4 + +=item B I + +Path to a JSON credentials file holding the credentials for a GCP service +account. + +If B is not specified, the plugin uses I. That means which credentials are used depends on the environment: + +=over 4 + +=item + +The environment variable C is checked. If this +variable is specified it should point to a JSON file that defines the +credentials. + +=item + +The path C<${HOME}/.config/gcloud/application_default_credentials.json> is +checked. This where credentials used by the I command line utility are +stored. You can use C to create these +credentials. + +Please note that these credentials are often of your personal account, not a +service account, and are therefore unfit to be used in a production +environment. + +=item + +When running on GCE, the built-in service account associated with the virtual +machine instance is used. +See also the B option below. + +=back + +=item B I + +The I or the I of the I. The +I is a string identifying the GCP project, which you can chose +freely when creating a new project. The I is a 12-digit decimal +number. You can look up both on the I. + +This setting is optional. If not set, the project ID is read from the +credentials file or determined from the GCE's metadata service. + +=item B I (GCE only) + +Choses the GCE I used for authentication. + +Each GCE instance has a C I but may also be +associated with additional I. This is often used to restrict +the permissions of services running on the GCE instance to the required +minimum. The I requires the +C scope. When multiple I are available, this option selects which one is used by +I. + +=item B I + +Configures the I to use when storing metrics. +More information on I and I are +available at L. + +This block takes one string argument, the I. Inside the block are +one or more B