From: Florian Forster Date: Fri, 12 May 2017 09:18:52 +0000 (+0200) Subject: Merge branch 'collectd-5.7' X-Git-Tag: collectd-5.8.0~188 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=c88c2de1c9cd6795b30c34990a565d18b69221e7;hp=58057152eeb3939c8b12872c9fa8faa9331c7a2a;p=collectd.git Merge branch 'collectd-5.7' --- diff --git a/configure.ac b/configure.ac index 320572d0..d4207ab6 100644 --- a/configure.ac +++ b/configure.ac @@ -1039,6 +1039,92 @@ if test "x$GCC" = "xyes"; then fi # }}} Check for strptime +# Check for timegm {{{ + +# These checks need -Werror because implicit function declarations are only a +# warning ... +SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Werror" + +AC_CACHE_CHECK([for timegm], + [c_cv_have_timegm], + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( +[[[ +#if STRPTIME_NEEDS_STANDARDS +# ifndef _ISOC99_SOURCE +# define _ISOC99_SOURCE 1 +# endif +# ifndef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 200112L +# endif +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 500 +# endif +#endif +#include +]]], +[[[ + time_t t = timegm(&(struct tm){0}); + if (t == ((time_t) -1)) { + return 1; + } +]]] + )], + [c_cv_have_timegm="yes"], + [c_cv_have_timegm="no"] + ) +) + +if test "x$c_cv_have_timegm" != "xyes" +then + AC_CACHE_CHECK([for timegm with _BSD_SOURCE], + [c_cv_have_timegm_bsd], + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( +[[[ +#if STRPTIME_NEEDS_STANDARDS +# ifndef _ISOC99_SOURCE +# define _ISOC99_SOURCE 1 +# endif +# ifndef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 200112L +# endif +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 500 +# endif +#endif +#ifndef _BSD_SOURCE +# define _BSD_SOURCE 1 +#endif +#include +]]], +[[[ + time_t t = timegm(&(struct tm){0}); + if (t == ((time_t) -1)) { + return 1; + } +]]] + )], + [c_cv_have_timegm_bsd="yes" + c_cv_have_timegm="yes"], + [c_cv_have_timegm_bsd="no"] + ) + ) +fi + +if test "x$c_cv_have_timegm" = "xyes" +then + AC_DEFINE(HAVE_TIMEGM, 1, [Define if the timegm(3) function is available.]) + if test "x$c_cv_have_timegm_bsd" = "xyes" + then + AC_DEFINE(TIMEGM_NEEDS_BSD, 1, [Set to true if timegm is only exported in BSD mode.]) + fi +fi + +CFLAGS="$SAVE_CFLAGS" +# }}} Check for timegm + AC_MSG_CHECKING([for sysctl kern.cp_times]) if test -x /sbin/sysctl; then /sbin/sysctl kern.cp_times >/dev/null 2>&1 diff --git a/src/bind.c b/src/bind.c index 9d407d1a..91e995f9 100644 --- a/src/bind.c +++ b/src/bind.c @@ -35,11 +35,19 @@ #endif #endif /* STRPTIME_NEEDS_STANDARDS */ +#if TIMEGM_NEEDS_BSD +#ifndef _BSD_SOURCE +#define _BSD_SOURCE 1 +#endif +#endif /* TIMEGM_NEEDS_BSD */ + #include "collectd.h" #include "common.h" #include "plugin.h" +#include + /* Some versions of libcurl don't include this themselves and then don't have * fd_set available. */ #if HAVE_SYS_SELECT_H @@ -429,8 +437,28 @@ static int bind_xml_read_timestamp(const char *xpath_expression, /* {{{ */ return (-1); } - tzset(); - *ret_value = mktime(&tm) - timezone; /* fix strptime() misinterpretation */ +#if HAVE_TIMEGM + time_t t = timegm(&tm); + if (t == ((time_t)-1)) { + char errbuf[1024]; + ERROR("bind plugin: timegm() failed: %s", + sstrerror(errno, errbuf, sizeof(errbuf))); + return (-1); + } + *ret_value = t; +#else + time_t t = mktime(&tm); + if (t == ((time_t)-1)) { + char errbuf[1024]; + ERROR("bind plugin: mktime() failed: %s", + sstrerror(errno, errbuf, sizeof(errbuf))); + return (-1); + } + /* mktime assumes that tm is local time. Luckily, it also sets timezone to + * the offset used for the conversion, and we undo the conversion to convert + * back to UTC. */ + *ret_value = t - timezone; +#endif xmlXPathFreeObject(xpathObj); return (0); diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 43bc0ef4..31b5274c 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -338,7 +338,7 @@ is enabled by default. =item B I Configure the name of the "pre-cache chain" and the "post-cache chain". Please -see L below on information on chains and how these +see L below on information on chains and how these setting change the daemon's behavior. =back @@ -1372,6 +1372,8 @@ Select I based on the name. Whether only matching I are collected or if they are ignored is controlled by the B option; see below. +See F for details. + =item B B|B Invert the selection: If set to true, all cgroups I the ones that @@ -2268,14 +2270,20 @@ values. Defaults to the global hostname setting. Select partitions based on the devicename. +See F for details. + =item B I Select partitions based on the mountpoint. +See F for details. + =item B I Select partitions based on the filesystem type. +See F for details. + =item B B|B Invert the selection: If set to true, all partitions B the ones that @@ -2337,6 +2345,8 @@ is interpreted as a regular expression. Examples: Disk "sdd" Disk "/hda[34]/" +See F for details. + =item B B|B Sets whether selected disks, i.Ee. the ones matches by any of the B @@ -3139,6 +3149,8 @@ than 1 sec. Select this interface. By default these interfaces will then be collected. For a more detailed description see B below. +See F for details. + =item B I|I If no configuration if given, the B-plugin will collect data from @@ -3200,6 +3212,8 @@ This option is only available on Solaris. Selects sensors to collect or to ignore, depending on B. +See F for details. + =item B I|I If no configuration if given, the B plugin will collect data from all @@ -3256,6 +3270,8 @@ comment or the number. Select this irq. By default these irqs will then be collected. For a more detailed description see B below. +See F for details. + =item B I|I If no configuration if given, the B-plugin will collect data from all @@ -3501,6 +3517,8 @@ Select md devices based on device name. The I is the basename of the device, i.e. the name of the block device without the leading C. See B for more details. +See F for details. + =item B B|B Invert device selection: If set to B, all md devices B those @@ -4664,6 +4682,8 @@ regular and exact matching are case sensitive. If no volume was specified at all for either of the three options, that data will be collected for all available volumes. +See F for details. + =item B B|B =item B B|B @@ -4849,6 +4869,8 @@ Here are some examples to help you understand the above text more easily: Filter "ppp0" "u32-1:0" +See F for details. + =item B The behavior is the same as with all other similar plugins: If nothing is @@ -5400,6 +5422,8 @@ C). B is not used. As there can be multiple devices on the bus you can list multiple sensor (use multiple B elements). +See F for details. + =item B I|I If no configuration is given, the B plugin will collect data from all @@ -6582,6 +6606,8 @@ Whether only matched values are selected or all matched values are ignored depends on the B. By default, only matched values are selected. If no value is configured at all, all values will be selected. +See F for details. + =item B B|B If set to B, inverts the selection made by B, i.Ee. all @@ -7010,6 +7036,8 @@ on the B below. For example, the option "B I" will cause collectd to gather data for the voltage sensor I of the I on the isa bus at the address 0290. +See F for details. + =item B I|I If no configuration if given, the B-plugin will collect data from all @@ -7119,6 +7147,8 @@ is interpreted as a regular expression. Examples: Disk "sdd" Disk "/hda[34]/" +See F for details. + =item B B|B Sets whether selected disks, i.Ee. the ones matches by any of the B @@ -7806,6 +7836,8 @@ Selects the name of the thermal device that you want to collect or ignore, depending on the value of the B option. This option may be used multiple times to specify a list of devices. +See F for details. + =item B I|I Invert the selection: If set to true, all devices B the ones that @@ -10273,6 +10305,48 @@ be an FQDN. Target "write" +=head1 IGNORELISTS + +B are a generic framework to either ignore some metrics or report +specific metircs only. Plugins usually provide one or more options to specify +the items (mounts points, devices, ...) and the boolean option +C. + +=over 4 + +=item B option may be repeated to select multiple items. + +=item B B|B + +If set to B, matching metrics are I and all other metrics are +collected. If set to B, matching metrics are I and all other +metrics are ignored. + +=back + =head1 SEE ALSO L,