Merge branch 'ff/nagios'
authorFlorian Forster <octo@collectd.org>
Tue, 1 Dec 2015 15:07:44 +0000 (16:07 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 1 Dec 2015 15:07:44 +0000 (16:07 +0100)
1  2 
configure.ac
src/Makefile.am
src/collectd.conf.in
src/collectd.conf.pod

diff --combined configure.ac
@@@ -57,23 -57,12 +57,23 @@@ AC_PROG_YAC
  PKG_PROG_PKG_CONFIG
  
  AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
 -AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h],
 -                 [have_protobuf_c_h="yes"],
 -                 [have_protobuf_c_h="no"])
 -if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes"
 +if test "x$have_protoc_c" = "xno"
  then
 -      have_protoc_c="no (unable to find <google/protobuf-c/protobuf-c.h>)"
 +      have_protoc_c="no (protoc-c compiler not found)"
 +fi
 +
 +if test "x$have_protoc_c" = "xyes"
 +then
 +      AC_CHECK_HEADERS([protobuf-c/protobuf-c.h google/protobuf-c/protobuf-c.h],
 +                       [have_protoc_c="yes"; break],
 +                       [have_protoc_c="no (<google/protobuf-c/protobuf-c.h> not found)"])
 +fi
 +if test "x$have_protoc_c" = "xyes"
 +then
 +      AC_CHECK_LIB([protobuf-c], [protobuf_c_message_pack],
 +                   [have_protoc_c="yes"],
 +                   [have_protoc_c="no (libprotobuf-c not found)"])
 +
  fi
  AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
  
@@@ -1265,8 -1254,6 +1265,8 @@@ have_getvfsstat="no
  AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
  have_listmntent="no"
  AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
 +have_getmntent_r="no"
 +AC_CHECK_FUNCS(getmntent_r, [have_getmntent_r="yes"])
  
  have_getmntent="no"
  AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
@@@ -2036,6 -2023,12 +2036,6 @@@ the
                GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
        fi
  
 -      if test "x$GCRYPT_LDFLAGS" = "x"
 -      then
 -              gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
 -              GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
 -      fi
 -
        if test "x$GCRYPT_LIBS" = "x"
        then
                GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
  
  SAVE_CPPFLAGS="$CPPFLAGS"
  SAVE_LDFLAGS="$LDFLAGS"
 +SAVE_LIBS="$LIBS"
  CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
  LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
 +LIBS="$LIBS $GCRYPT_LIBS"
  
  if test "x$with_libgcrypt" = "xyes"
  then
  
  if test "x$with_libgcrypt" = "xyes"
  then
 -      if test "x$GCRYPT_LDFLAGS" != "x"
 -      then
 -              AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
 -      fi
        AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
                [with_libgcrypt="yes"],
                [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
 -
 -      if test "$with_libgcrypt" != "no"; then
 -              m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
 -              GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
 -              GCRYPT_LIBS="$LIBGCRYPT_LIBS"
 -      fi
  fi
  
  CPPFLAGS="$SAVE_CPPFLAGS"
  LDFLAGS="$SAVE_LDFLAGS"
 +LIBS="$SAVE_LIBS"
  
  if test "x$with_libgcrypt" = "xyes"
  then
        plugin_df="yes"
  fi
  
 +if test "x$c_cv_have_getmntent_r" = "xyes"
 +then
 +      plugin_df="yes"
 +fi
 +
  # Df plugin: Check if we have either `statfs' or `statvfs' second.
  if test "x$plugin_df" = "xyes"
  then
@@@ -5708,6 -5703,7 +5708,7 @@@ AC_PLUGIN([nfs],         [$plugin_nfs]
  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])
@@@ -6107,6 -6103,7 +6108,7 @@@ Configuration
      nginx . . . . . . . . $enable_nginx
      notify_desktop  . . . $enable_notify_desktop
      notify_email  . . . . $enable_notify_email
+     notify_nagios . . . . $enable_notify_nagios
      ntpd  . . . . . . . . $enable_ntpd
      numa  . . . . . . . . $enable_numa
      nut . . . . . . . . . $enable_nut
diff --combined src/Makefile.am
@@@ -211,7 -211,8 +211,7 @@@ endi
  
  if BUILD_PLUGIN_CGROUPS
  pkglib_LTLIBRARIES += cgroups.la
 -cgroups_la_SOURCES = cgroups.c \
 -                   utils_ignorelist.c utils_ignorelist.h
 +cgroups_la_SOURCES = cgroups.c
  cgroups_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  cgroups_la_LIBADD = libmount.la
  endif
@@@ -310,14 -311,16 +310,14 @@@ endi
  
  if BUILD_PLUGIN_DF
  pkglib_LTLIBRARIES += df.la
 -df_la_SOURCES = df.c \
 -              utils_ignorelist.c utils_ignorelist.h
 +df_la_SOURCES = df.c
  df_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  df_la_LIBADD = libmount.la
  endif
  
  if BUILD_PLUGIN_DISK
  pkglib_LTLIBRARIES += disk.la
 -disk_la_SOURCES = disk.c \
 -                utils_ignorelist.c utils_ignorelist.h
 +disk_la_SOURCES = disk.c
  disk_la_CFLAGS = $(AM_CFLAGS)
  disk_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  disk_la_LIBADD =
@@@ -420,7 -423,8 +420,7 @@@ endi
  
  if BUILD_PLUGIN_INTERFACE
  pkglib_LTLIBRARIES += interface.la
 -interface_la_SOURCES = interface.c \
 -                     utils_ignorelist.c utils_ignorelist.h
 +interface_la_SOURCES = interface.c
  interface_la_CFLAGS = $(AM_CFLAGS)
  interface_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  interface_la_LIBADD =
@@@ -457,7 -461,8 +457,7 @@@ endi
  
  if BUILD_PLUGIN_IPMI
  pkglib_LTLIBRARIES += ipmi.la
 -ipmi_la_SOURCES = ipmi.c \
 -                utils_ignorelist.c utils_ignorelist.h
 +ipmi_la_SOURCES = ipmi.c
  ipmi_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_OPENIPMI_CFLAGS)
  ipmi_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  ipmi_la_LIBADD = $(BUILD_WITH_OPENIPMI_LIBS)
@@@ -476,7 -481,8 +476,7 @@@ endi
  
  if BUILD_PLUGIN_IRQ
  pkglib_LTLIBRARIES += irq.la
 -irq_la_SOURCES = irq.c \
 -               utils_ignorelist.c utils_ignorelist.h
 +irq_la_SOURCES = irq.c
  irq_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  endif
  
@@@ -535,7 -541,8 +535,7 @@@ endi
  
  if BUILD_PLUGIN_MADWIFI
  pkglib_LTLIBRARIES += madwifi.la
 -madwifi_la_SOURCES = madwifi.c madwifi.h \
 -                   utils_ignorelist.c utils_ignorelist.h
 +madwifi_la_SOURCES = madwifi.c madwifi.h
  madwifi_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  endif
  
@@@ -581,7 -588,8 +581,7 @@@ endi
  
  if BUILD_PLUGIN_MD
  pkglib_LTLIBRARIES += md.la
 -md_la_SOURCES = md.c \
 -              utils_ignorelist.c utils_ignorelist.h
 +md_la_SOURCES = md.c
  md_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  endif
  
@@@ -626,7 -634,8 +626,7 @@@ endi
  
  if BUILD_PLUGIN_MIC
  pkglib_LTLIBRARIES += mic.la
 -mic_la_SOURCES = mic.c \
 -               utils_ignorelist.c utils_ignorelist.h
 +mic_la_SOURCES = mic.c
  mic_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_MIC_LIBPATH)
  mic_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_MIC_CPPFLAGS)
  mic_la_LIBADD = $(BUILD_WITH_MIC_LDADD)
@@@ -668,7 -677,8 +668,7 @@@ endi
  
  if BUILD_PLUGIN_NETAPP
  pkglib_LTLIBRARIES += netapp.la
 -netapp_la_SOURCES = netapp.c \
 -                  utils_ignorelist.c utils_ignorelist.h
 +netapp_la_SOURCES = netapp.c
  netapp_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBNETAPP_CPPFLAGS)
  netapp_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(LIBNETAPP_LDFLAGS)
  netapp_la_LIBADD = $(LIBNETAPP_LIBS)
@@@ -738,6 -748,12 +738,12 @@@ notify_email_la_LDFLAGS = $(PLUGIN_LDFL
  notify_email_la_LIBADD = -lesmtp -lssl -lcrypto -lpthread
  endif
  
+ if BUILD_PLUGIN_NOTIFY_NAGIOS
+ pkglib_LTLIBRARIES += notify_nagios.la
+ notify_nagios_la_SOURCES = notify_nagios.c
+ notify_nagios_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+ endif
  if BUILD_PLUGIN_NTPD
  pkglib_LTLIBRARIES += ntpd.la
  ntpd_la_SOURCES = ntpd.c
@@@ -774,7 -790,8 +780,7 @@@ endi
  
  if BUILD_PLUGIN_ONEWIRE
  pkglib_LTLIBRARIES += onewire.la
 -onewire_la_SOURCES = onewire.c \
 -                   utils_ignorelist.c utils_ignorelist.h
 +onewire_la_SOURCES = onewire.c
  onewire_la_CFLAGS = $(AM_CFLAGS)
  onewire_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
  onewire_la_LIBADD = $(BUILD_WITH_LIBOWCAPI_LIBS)
@@@ -887,7 -904,8 +893,7 @@@ endi
  
  if BUILD_PLUGIN_PROTOCOLS
  pkglib_LTLIBRARIES += protocols.la
 -protocols_la_SOURCES = protocols.c \
 -                     utils_ignorelist.c utils_ignorelist.h
 +protocols_la_SOURCES = protocols.c
  protocols_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  endif
  
@@@ -925,7 -943,8 +931,7 @@@ endi
  
  if BUILD_PLUGIN_SENSORS
  pkglib_LTLIBRARIES += sensors.la
 -sensors_la_SOURCES = sensors.c \
 -                   utils_ignorelist.c utils_ignorelist.h
 +sensors_la_SOURCES = sensors.c
  sensors_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBSENSORS_CFLAGS)
  sensors_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBSENSORS_LDFLAGS)
  sensors_la_LIBADD = -lsensors
@@@ -948,7 -967,8 +954,7 @@@ endi
  if BUILD_PLUGIN_SMART
  if BUILD_WITH_LIBUDEV
  pkglib_LTLIBRARIES += smart.la
 -smart_la_SOURCES = smart.c \
 -                 utils_ignorelist.c utils_ignorelist.h
 +smart_la_SOURCES = smart.c
  smart_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBATASMART_CPPFLAGS)
  smart_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBATASMART_LDFLAGS)
  smart_la_LIBADD = $(BUILD_WITH_LIBATASMART_LIBS) -ludev
@@@ -1087,7 -1107,8 +1093,7 @@@ endi
  
  if BUILD_PLUGIN_THERMAL
  pkglib_LTLIBRARIES += thermal.la
 -thermal_la_SOURCES = thermal.c \
 -                   utils_ignorelist.c utils_ignorelist.h
 +thermal_la_SOURCES = thermal.c
  thermal_la_LDFLAGS = $(PLUGIN_LDFLAGS)
  endif
  
@@@ -1172,7 -1193,8 +1178,7 @@@ endi
  
  if BUILD_PLUGIN_VIRT
  pkglib_LTLIBRARIES += virt.la
 -virt_la_SOURCES = virt.c \
 -                utils_ignorelist.c utils_ignorelist.h
 +virt_la_SOURCES = virt.c
  virt_la_CFLAGS = $(AM_CFLAGS) \
                $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
  virt_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
@@@ -1366,30 -1388,25 +1372,30 @@@ EXTRA_DIST +=   collectd.conf.pod 
                echo "$@ has some POD errors!"; false; \
        fi
  
 +AM_V_PROTOC_C = $(am__v_PROTOC_C_@AM_V@)
 +am__v_PROTOC_C_ = $(am__v_PROTOC_C_@AM_DEFAULT_V@)
 +am__v_PROTOC_C_0 = @echo "  PROTOC-C    " $@;
 +am__v_PROTOC_C_1 =
 +
  # Protocol buffer for the "pinba" plugin.
  EXTRA_DIST += pinba.proto
 -if HAVE_PROTOC_C
 +if BUILD_PLUGIN_PINBA
  CLEANFILES += pinba.pb-c.c pinba.pb-c.h
  BUILT_SOURCES += pinba.pb-c.c pinba.pb-c.h
  
  pinba.pb-c.c pinba.pb-c.h: pinba.proto
 -      protoc-c -I$(srcdir) --c_out . $(srcdir)/pinba.proto
 +      $(AM_V_PROTOC_C)protoc-c -I$(srcdir) --c_out . $(srcdir)/pinba.proto
  endif
  
  # Protocol buffer for the "write_riemann" plugin.
  EXTRA_DIST += riemann.proto
 -if HAVE_PROTOC_C
 +if BUILD_PLUGIN_WRITE_RIEMANN
  CLEANFILES += riemann.pb-c.c riemann.pb-c.h
  
  BUILT_SOURCES += riemann.pb-c.c riemann.pb-c.h
  
  riemann.pb-c.c riemann.pb-c.h: riemann.proto
 -      protoc-c -I$(srcdir) --c_out . $(srcdir)/riemann.proto
 +      $(AM_V_PROTOC_C)protoc-c -I$(srcdir) --c_out . $(srcdir)/riemann.proto
  endif
  
  install-exec-hook:
@@@ -1410,11 -1427,4 +1416,11 @@@ uninstall-hook
        rm -f $(DESTDIR)$(sysconfdir)/collectd.conf
        rm -f $(DESTDIR)$(pkgdatadir)/postgresql_default.conf;
  
 -
 +if BUILD_PLUGIN_CEPH
 +test_plugin_ceph_SOURCES = ceph_test.c
 +test_plugin_ceph_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBYAJL_CPPFLAGS)
 +test_plugin_ceph_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBYAJL_LDFLAGS)
 +test_plugin_ceph_LDADD = daemon/libcommon.la daemon/libplugin_mock.la $(BUILD_WITH_LIBYAJL_LIBS)
 +check_PROGRAMS += test_plugin_ceph
 +TESTS += test_plugin_ceph
 +endif
diff --combined src/collectd.conf.in
  #@BUILD_PLUGIN_NGINX_TRUE@LoadPlugin nginx
  #@BUILD_PLUGIN_NOTIFY_DESKTOP_TRUE@LoadPlugin notify_desktop
  #@BUILD_PLUGIN_NOTIFY_EMAIL_TRUE@LoadPlugin notify_email
+ #@BUILD_PLUGIN_NOTIFY_NAGIOS_TRUE@LoadPlugin notify_nagios
  #@BUILD_PLUGIN_NTPD_TRUE@LoadPlugin ntpd
  #@BUILD_PLUGIN_NUMA_TRUE@LoadPlugin numa
  #@BUILD_PLUGIN_NUT_TRUE@LoadPlugin nut
  
  #<Plugin "battery">
  #  ValuesPercentage false
 -#  ReportDegraded
 +#  ReportDegraded false
  #</Plugin>
  
  #<Plugin "bind">
  #             Prefix "collectd"
  #             StoreRates true
  #             Retain false
 +#             CACert "/etc/ssl/ca.crt"
 +#             CertificateFile "/etc/ssl/client.crt"
 +#             CertificateKeyFile "/etc/ssl/client.pem"
 +#             TLSProtocol "tlsv1.2"
 +#             CipherSuite "ciphers"
  #     </Publish>
  #     <Subscribe "name">
  #             Host "localhost"
  #     Recipient "email2@domain2.com"
  #</Plugin>
  
+ #<Plugin notify_nagios>
+ #     CommandFile "/usr/local/nagios/var/rw/nagios.cmd"
+ #</Plugin>
  #<Plugin ntpd>
  #     Host "localhost"
  #     Port 123
diff --combined src/collectd.conf.pod
@@@ -3347,38 -3347,6 +3347,38 @@@ Configures the topic(s) to subscribe to
  multi level C<#> wildcards. Defaults to B<collectd/#>, i.e. all topics beneath
  the B<collectd> branch.
  
 +=item B<CACert> I<file>
 +
 +Path to the PEM-encoded CA certificate file. Setting this option enables TLS
 +communication with the MQTT broker, and as such, B<Port> should be the TLS-enabled
 +port of the MQTT broker.
 +A valid TLS configuration requires B<CACert>, B<CertificateFile> and B<CertificateKeyFile>.
 +
 +=item B<CertificateFile> I<file>
 +
 +Path to the PEM-encoded certificate file to use as client certificate when
 +connecting to the MQTT broker.
 +A valid TLS configuration requires B<CACert>, B<CertificateFile> and B<CertificateKeyFile>.
 +
 +=item B<CertificateKeyFile> I<file>
 +
 +Path to the unencrypted PEM-encoded key file corresponding to B<CertificateFile>.
 +A valid TLS configuration requires B<CACert>, B<CertificateFile> and B<CertificateKeyFile>.
 +
 +=item B<TLSProtocol> I<protocol>
 +
 +If configured, this specifies the string protocol version (e.g. C<tlsv1>,
 +C<tlsv1.2>) to use for the TLS connection to the broker. If not set a default
 +version is used which depends on the version of OpenSSL the Mosquitto library
 +was linked against.
 +
 +=item B<CipherSuite> I<ciphersuite>
 +
 +A string describing the ciphers available for use. See L<ciphers(1)> and the
 +C<openssl ciphers> utility for more information. If unset, the default ciphers
 +will be used.
 +
 +
  =back
  
  =head2 Plugin C<mysql>
@@@ -4436,6 -4404,21 +4436,21 @@@ Default: C<Collectd notify: %s@%s
  
  =back
  
+ =head2 Plugin C<notify_nagios>
+ The I<notify_nagios> plugin writes notifications to Nagios' I<command file> as
+ a I<passive service check result>.
+ Available configuration options:
+ =over 4
+ =item B<CommandFile> I<Path>
+ Sets the I<command file> to write to. Defaults to F</usr/local/nagios/var/rw/nagios.cmd>.
+ =back
  =head2 Plugin C<ntpd>
  
  =over 4