+2012-04-01, Version 5.0.4
+ * Build system: Fix the use of a libltdl macro. Thanks to Clemens Lang
+ for fixing this. Adresses some issues with building the iptables
+ plugin under Gentoo.
+ * libcollectdclient: A memory leak in the lcc_getval() function has
+ been fixed. Thanks to Jason Schmidlapp for finding and fixing this
+ issue.
+ * bind plugin: The use of 'QType" types has been fixed.
+ * df plugin: Fixed compiler issue under Mac OS X 10.7.
+ * conntrack plugin: Support zero as legitimate value. Thanks to Louis
+ Opter for his patch.
+ * memcached plugin: Increased the size of a static buffer, which was
+ truncating status messages form memcached. Thanks to Timon for the
+ patch.
+ * network plugin: Forwarding of notifications has been disabled. This
+ was a contition not checked for before, which may retult in an
+ endless loop.
+ * processes plugin: Support for process names with spaces has been
+ added to the Linux implementation. Thanks to Darrell Bishop for his
+ patch.
+ * perl plugin: A race condition in several callbacks, including log and
+ write callbacks, has been fixed. Thanks to "Rrpv" for reporting this
+ bug.
+ * snmp plugin: A bug when casting unsigned integers to gauge values has
+ been fixed: Unsigned integers would be cast to a signed integer and
+ then to a gauge, possibly resulting in a negative value.
+ * tcpconns plugin: Compilation with newer versions of the FreeBSD
+ runtime has been fixed.
+
+2012-02-19, Version 5.0.3
+ * Build system: Fix problems when building the ipvs and iptables
+ plugins. Thanks to Sebastian Harl for his patch. A bashism in the
+ version-gen.sh script has been fixed. Thanks to Jo-Philipp Wich for
+ his patch.
+ * csv and rrdtool plugins: Print a more helpful error message when the
+ DataDir is a symlink pointing to a non-existing location. Thanks to
+ Jonathan Nieder for his patch.
+ * exec plugin: Fix a problem when using select(2) to read from file
+ handles. Thanks to Gerrie Roos for his patch.
+ * network plugin: An incorrect error message in the handling of the
+ "Interface" configuration option has been fixed. Thanks to Gerrie
+ Roos for his patch.
+ * oracle plugin: A potential endless loop in the error handling has
+ been fixed.
+ * python plugin: A crash bug in the configuration handling has been
+ fixed. Thanks to Sven Trenkel for his patch.
+ * interfaces plugin: The change which was supposed to ignore "bogus"
+ interfaces has been reverted, since it ignored legit interfaces, such
+ as bonding pseudo-devices as well.
+
+2012-01-21, Version 5.0.2
+ * curl_xml plugin: Fix handling of file:// and other URLs (which don't
+ follow HTTP status codes). Thanks to Fabien Wernli for his patch!
+ * df plugin: Fix handling of negative "available" counts. This can
+ occur with some file systems, for example UFS. Thanks to Toni Ylenius
+ for his patch.
+ * interface plugin: "mac" interfaces are now ignored on Solaris. These
+ pseudo-interfaces occur multiple times, causing warnings. Also switch
+ to 64-bit counters on Solaris, improving overflow behavior for
+ high-speed interfaces. Thanks to Eddy Geez and Fabien Wernli for
+ their patches.
+ * memory plugin: Account kernel and unused memory under Solaris. Thanks
+ to Fabien Wernli for his patch.
+ * network plugin: A bug in the interaction between the Network plugin
+ and filter chains has been fixed: When a filter modified a field such
+ as the hostname, subsequent values in the same network packets could
+ have ended up using the modified name rather than the original name.
+ Thanks to Sebastian Harl for identifying the problem.
+ * oracle plugin: A memory leak has been fixed in the parameter handling.
+ * python plugin: A memory leak has been fixed. Thanks to Sven Trenkel
+ for fixing this bug!
+
+2011-10-07, Version 5.0.1
+ * collectd: A mutex leak has been fixed in the meta data code. Thanks
+ to Rafal Lesniak for his patch.
+ * collectd: Compatibility fixes for GCC 4.6 have been applied. Thanks
+ to Peter Green for his patch.
+ * csv plugin: The line buffer size has been increased. Thanks to Colin
+ McCabe for the patch.
+ * curl_json plugin: Don't use the "parent" node to build the type
+ instance, if it is empty. Compatibility with libyajl 2 has been
+ added. Thanks to "spupykin" of the Arch Linux project for the initial
+ code. Formatting of time has been fixed in the JSON module.
+ * exec plugin: Fix the timestamp value passed to notification scripts.
+ Thanks to Alexander Kovalenko for fixing this.
+ * iptables plugin: Fix linking with some versions of libiptc.
+ * irq plugin: Fix support for interrupts under Linux. The old code
+ assumed that interrupts have a numeric value -- this is no longer
+ true for Linux. Thanks to Bostjan Skufca for implementing this.
+ * notify_desktop plugin: Compatibility with libnotify 0.7 has been
+ added. Thanks to Samuli Suominen for his patch.
+ * processes plugin: Fix handling of regular expressions containing
+ spaces. Thanks for Sebastian Harl for fixing this.
+ * rrdtool, rrdcached plugins: Improve precision of the XFF parameter.
+ Previously, values like 0.999 would have been rounded to 1.0. Thanks
+ to Francois-Xavier Bourlet for fixing this.
+ * varnish plugin: Fix data type handling of some metrics. Some values
+ were submitted as gauge even though they were derives.
+ * Various plugin: Set a multi-threading flag in libcurl. Thanks to Mike
+ Flisher for the fix.
+
+2011-03-28, Version 5.0.0
+ * collectd: The "FQDNLookup" option is now enabled by default.
+ * collectd: The internal representation of time has been changed to
+ allow a higher accuracy than one second.
+ * collectdcmd: This new command line utility can send various commands
+ to collectd using the UnixSock plugin. Thanks to Håkon Dugstad
+ Johnsen and Sebastian Harl for their code.
+ * collectd-nagios: The "-m" option has been implemented (treat NaNs as
+ critical).
+ * collectd-tg: Traffic generator creating bogus network traffic
+ compatible to the Network plugin. This utility can be used to
+ stress-test new write plugins and collectd in general.
+ * libcollectdclient: Creating and sending network packets has been
+ added to the collectd client library.
+ * All data sets: The data source name of all data sets with exactly
+ one data source has been changed to "value".
+ * All plugins: All "counter" data sources have been converted to
+ "derive" data sources. All plugins now use "derive" by default, but
+ plugins such as the network plugin can still handle "counter", of
+ course. The minimum value of all derive data sources is zero, the
+ maximum value is unspecified.
+ * amqp plugin: The new AMQP plugin can send data to and receive data
+ from an AMQP broker. Thanks to Sebastien Pahl for his code.
+ * apache plugin: Backwards compatibility code has been removed.
+ Support for the IBM HTTP Server has been added. Thanks to Manuel
+ Luis Sanmartín Rozada for his patch.
+ * contextswitch plugin: Support for sysctlbyname(3) has been added.
+ Thanks to Kimo Rosenbaum for his patch.
+ * df plugin: The default behavior has been changed to be equivalent to
+ the "ReportReserved" behavior of v4.
+ * dns plugin: Improved RFC 1035 name parsing has been imported from
+ "dnstop".
+ * exec plugin: Backwards compatibility code has been removed.
+ * GenericJMX plugin: The "InstancePrefix" option has been added to
+ "Connection" blocks.
+ * hddtemp plugin: The "TranslateDevicename" config option has been
+ removed.
+ * interface plugin: Use the "plugin instance" to store the interface
+ value.
+ * libvirt plugin: The "InterfaceFormat" option has been added. Thanks
+ to Ruben Kerkhof for his patch.
+ * lpar plugin: New plugins for "logical partitions", a virtualization
+ technique of POWER CPUs. Thanks to Aurélien Reynaud for his code and
+ patience.
+ * modbus plugin: Support for libmodbus 2.9.2 has been added and the
+ license has been changes to LGPLv2.1.
+ * mysql plugin: Backwards compatibility code has been removed. The
+ data sets used have been improved.
+ * network plugin: The default buffer size has been increased to
+ 1452 bytes.
+ * perl plugin: Backwards compatibility code has been removed.
+ * postgresql plugin: Backwards compatibility code has been removed.
+ * redis plugin: Plugin for collecting statistics from Redis, a key-
+ value store, has been added. Thanks to Andres J. Diaz for his code.
+ * swap plugin: Implement collection of physical and virtual memory
+ statistics under Solaris. The new default is collecting physical
+ memory. Thanks to Aurélien Reynaud for his patches.
+ * threshold plugin: The threshold configuration has been moved into
+ this separate plugin.
+ * unixsock plugin: The "DeleteSocket" option has been added.
+ * varnish plugin: The new Varnish plugin reads statistics from
+ Varnish, a web accelerator. Thanks to Jérôme Renard and Marc
+ Fournier for their contributions.
+ * write_redis: New plugin for writing data to Redis, a key-value
+ store.
+ * zfs_arc plugin: The data sets have been replaced by more elegant
+ alternatives.
+ * v5upgrade target: Target for converting v4 data sets to the v5
+ schema.
+
+ 2012-11-11, Version 4.10.8
+ * collectd: Create new directories with mode 0777 and let umask remove
+ unwanted permission bits.
+ * collectd: Build issues have been fixed.
+ * collectd: An incorrect assertion has been fixed in some common code
+ for Solaris. This should resolve pseudo-random assertion failures
+ under Solaris. Thanks to Jeff Blane for his help debugging this.
+ * collectd: A couple of memory leaks through PThread thread attributes
+ have been fixed. Thanks to Gerrie Roos for fixing these.
+ * apcups plugin: Improve the reconnect behavior.
+ * df plugin: Ignore "rootfs" devices under Linux to avoid having them
+ reported twice. Thanks to Brune Prémont for fixing this.
+ * disk plugin: Fix incorrect computation of read and write latency (the
+ "disk_time" type). Previously, the numbers reported where too small
+ by a factor of "interval", e.g. when the interval is set to 10
+ seconds, the values were too low by a factor of 10. Thanks to Manuel
+ Sanmartin for reporting this problem.
+ * dns plugin: A build issue under Solaris has been fixed. A erroneous
+ define that could lead to the reporting of bad data has been fixed by
+ Daniel Sutto.
+ * memcachec plugin: A bug in the configuration handling has been fixed.
+ Thanks to Pascal Hofmann for fixing this issue.
+ * netapp plugin: Correctly close the connection on communication
+ errors.
+ * netlink plugin: The function used to query statistics has been
+ changed to be more in line with iproute2's behavior. Thanks to
+ "KIvosak" for the patch.
+ * network plugin: Initialization of libgcrypt has been fixed. Thanks to
+ Chris Lundquist for his patch.
+ * oracle plugin: Error messages have been improved.
+ * ping plugin: Don't enter the exponential back-off mode when
+ ping_send() fails. This should make recovery after a network failure
+ much faster.
+ * python plugin: Memory leaks have been fixed. Thanks to Tommie Gannert
+ and Sven Trenkel for fixing this.
+ * rrdtool plugin: Fix an out-of-bounds array access when printing a
+ warning message. Thanks to Will Hawkins for fixing this bug.
+ * snmp plugin: Support for the SNMP_ENDOFMIBVIEW return value has been
+ added. Support for more complex / unusual MIBs / subtrees has been
+ added. Thanks to Mark Juric to test the changes and point out these
+ problems.
+
2012-04-01, Version 4.10.7
* Build system: Fix the use of a libltdl macro. Thanks to Clemens Lang
for fixing this. Adresses some issues with building the iptables
if test "x$ac_system" = "xSolaris"
then
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
+ AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
fi
if test "x$ac_system" = "xAIX"
then
if test "x$enable_standards" = "xyes"
then
AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
- AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
- AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
+ AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
+ AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
+ if test "x$GCC" = "xyes"
+ then
+ CFLAGS="$CFLAGS -std=c99"
+ fi
fi
AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
#endif
])
+AC_CHECK_HEADERS(netinet/ip_compat.h)
+
# For the multimeter plugin
have_termios_h="no"
AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
+clock_gettime_needs_rt="no"
+clock_gettime_needs_posix4="no"
+have_clock_gettime="no"
+AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
+if test "x$have_clock_gettime" = "xno"
+then
+ AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
+ have_clock_gettime="yes"])
+fi
+if test "x$have_clock_gettime" = "xno"
+then
+ AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
+ have_clock_gettime="yes"])
+fi
+if test "x$have_clock_gettime" = "xyes"
+then
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
+else
+ AC_MSG_WARN(cannot find clock_gettime)
+fi
+
nanosleep_needs_rt="no"
nanosleep_needs_posix4="no"
AC_CHECK_FUNCS(nanosleep,
AC_CHECK_LIB(posix4, nanosleep,
[nanosleep_needs_posix4="yes"],
AC_MSG_ERROR(cannot find nanosleep))))
-AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
-AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
+
+AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
+AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
-AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
-# For load module
-AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
+# Check for strptime {{{
+if test "x$GCC" = "xyes"
+then
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wall -Wextra -Werror"
+fi
+
+AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
+if test "x$have_strptime" = "xyes"
+then
+ AC_CACHE_CHECK([whether strptime is exported by default],
+ [c_cv_have_strptime_default],
+ AC_COMPILE_IFELSE(
+AC_LANG_PROGRAM(
+[[
+AC_INCLUDES_DEFAULT
+#include <time.h>
+]],
+[[
+ struct tm stm;
+ (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
+]]),
+ [c_cv_have_strptime_default="yes"],
+ [c_cv_have_strptime_default="no"]))
+fi
+if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
+then
+ AC_CACHE_CHECK([whether strptime needs standards mode],
+ [c_cv_have_strptime_standards],
+ AC_COMPILE_IFELSE(
+AC_LANG_PROGRAM(
+[[
+#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
+AC_INCLUDES_DEFAULT
+#include <time.h>
+]],
+[[
+ struct tm stm;
+ (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
+]]),
+ [c_cv_have_strptime_standards="yes"],
+ [c_cv_have_strptime_standards="no"]))
+
+ if test "x$c_cv_have_strptime_standards" = "xyes"
+ then
+ AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
+ else
+ have_strptime="no"
+ fi
+fi
+
+if test "x$GCC" = "xyes"
+then
+ CFLAGS="$SAVE_CFLAGS"
+fi
+
+# }}} Check for strptime
+
+AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
+if test "x$have_swapctl" = "xyes"; then
+ AC_CACHE_CHECK([whether swapctl takes two arguments],
+ [c_cv_have_swapctl_two_args],
+ AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
+#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
+# undef _FILE_OFFSET_BITS
+# undef _LARGEFILE64_SOURCE
+#endif
+#include <sys/stat.h>
+#include <sys/swap.h>]],
+ [[
+ int num = swapctl(0, NULL);
+ ]]
+ ),
+ [c_cv_have_swapctl_two_args="yes"],
+ [c_cv_have_swapctl_two_args="no"]
+ )
+ )
+ AC_CACHE_CHECK([whether swapctl takes three arguments],
+ [c_cv_have_swapctl_three_args],
+ AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
+#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
+# undef _FILE_OFFSET_BITS
+# undef _LARGEFILE64_SOURCE
+#endif
+#include <sys/stat.h>
+#include <sys/swap.h>]],
+ [[
+ int num = swapctl(0, NULL,0);
+ ]]
+ ),
+ [c_cv_have_swapctl_three_args="yes"],
+ [c_cv_have_swapctl_three_args="no"]
+ )
+ )
+fi
+# Check for different versions of `swapctl' here..
+if test "x$have_swapctl" = "xyes"; then
+ if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
+ AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
+ [Define if the function swapctl exists and takes two arguments.])
+ fi
+ if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
+ AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
+ [Define if the function swapctl exists and takes three arguments.])
+ fi
+fi
# Check for NAN
AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
[[
#include <stdlib.h>
#include <math.h>
-static float foo = NAN;
+static double foo = NAN;
]],
[[
if (isnan (foo))
#include <stdlib.h>
#define __USE_ISOC99 1
#include <math.h>
-static float foo = NAN;
+static double foo = NAN;
]],
[[
if (isnan (foo))
#ifndef isnan
# define isnan(f) ((f) != (f))
#endif
-static float foo = NAN;
+static double foo = NAN;
]],
[[
if (isnan (foo))
if test "x$with_perfstat" = "xyes"
then
AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
+ # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
+ AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
+ if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
+ then
+ AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
+ fi
fi
AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
fi
AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
+# --with-libcredis {{{
+AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
+[
+ if test "x$withval" = "xyes"
+ then
+ with_libcredis="yes"
+ else if test "x$withval" = "xno"
+ then
+ with_libcredis="no"
+ else
+ with_libcredis="yes"
+ LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
+ LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
+ fi; fi
+],
+[with_libcredis="yes"])
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+
+CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
+
+if test "x$with_libcredis" = "xyes"
+then
+ if test "x$LIBCREDIS_CPPFLAGS" != "x"
+ then
+ AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
+ fi
+ AC_CHECK_HEADERS(credis.h,
+ [with_libcredis="yes"],
+ [with_libcredis="no (credis.h not found)"])
+fi
+if test "x$with_libcredis" = "xyes"
+then
+ if test "x$LIBCREDIS_LDFLAGS" != "x"
+ then
+ AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
+ fi
+ AC_CHECK_LIB(credis, credis_info,
+ [with_libcredis="yes"],
+ [with_libcredis="no (symbol 'credis_info' not found)"])
+
+fi
+
+CPPFLAGS="$SAVE_CPPFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
+
+if test "x$with_libcredis" = "xyes"
+then
+ BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
+ BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
+ AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
+ AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
+fi
+AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
+# }}}
+
# --with-libcurl {{{
with_curl_config="curl-config"
with_curl_cflags=""
$PKG_CONFIG --exists 'modbus' 2>/dev/null
if test $? -ne 0
then
- with_libmodbus="no (pkg-config doesn't know library)"
+ with_libmodbus="no (pkg-config doesn't know modbus)"
fi
fi
if test "x$with_libmodbus" = "xuse_pkgconfig"
CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
LDFLAGS="$LDFLAGS $with_libmodbus_libs"
- AC_CHECK_LIB(modbus, modbus_init_tcp,
+ AC_CHECK_LIB(modbus, modbus_connect,
[with_libmodbus="yes"],
- [with_libmodbus="no (symbol modbus_init_tcp not found)"])
+ [with_libmodbus="no (symbol modbus_connect not found)"])
CPPFLAGS="$SAVE_CPPFLAGS"
LDFLAGS="$SAVE_LDFLAGS"
#include <asm/types.h>
#include <sys/socket.h>])
- AC_COMPILE_IFELSE(
- [#include <stdio.h>
- #include <sys/types.h>
- #include <asm/types.h>
- #include <sys/socket.h>
- #include <linux/netlink.h>
- #include <linux/rtnetlink.h>
-
- int main (void)
- {
- int retval = TCA_STATS2;
- return (retval);
- }],
- [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
- []);
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <asm/types.h>
+ #include <sys/socket.h>
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>
+ ], [
+ int retval = TCA_STATS2;
+ return (retval);
+ ]
+ )],
+ [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
AC_COMPILE_IFELSE(
[#include <stdio.h>
fi
AC_CHECK_HEADERS(oping.h,
[with_liboping="yes"],
- [with_liboping="no ('oping.h' not found)"])
+ [with_liboping="no (oping.h not found)"])
fi
if test "x$with_liboping" = "xyes"
then
fi
if test "x$with_libpcap" = "xyes"
then
- AC_CHECK_HEADERS(pcap-bpf.h)
+ AC_CHECK_HEADERS(pcap-bpf.h,,
+ [with_libpcap="no (pcap-bpf.h not found)"])
fi
AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
# }}}
fi
# }}} --with-python
+# --with-librabbitmq {{{
+with_librabbitmq_cppflags=""
+with_librabbitmq_ldflags=""
+AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
+[
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ then
+ with_librabbitmq_cppflags="-I$withval/include"
+ with_librabbitmq_ldflags="-L$withval/lib"
+ with_librabbitmq="yes"
+ else
+ with_librabbitmq="$withval"
+ fi
+],
+[
+ with_librabbitmq="yes"
+])
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
+LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
+if test "x$with_librabbitmq" = "xyes"
+then
+ AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
+fi
+if test "x$with_librabbitmq" = "xyes"
+then
+ # librabbitmq up to version 0.9.1 provides "library_errno", later
+ # versions use "library_error". The library does not provide a version
+ # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
+ AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
+ [
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_STDIO_H
+# include <stdio.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#include <amqp.h>
+ ])
+fi
+if test "x$with_librabbitmq" = "xyes"
+then
+ AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
+fi
+if test "x$with_librabbitmq" = "xyes"
+then
+ BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
+ BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
+ BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
+ AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
+ AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
+ AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
+ AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
+fi
+CPPFLAGS="$SAVE_CPPFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
+AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
+# }}}
+
# --with-librouteros {{{
AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
[
fi
AC_CHECK_HEADERS(routeros_api.h,
[with_librouteros="yes"],
- [with_librouteros="no ('routeros_api.h' not found)"])
+ [with_librouteros="no (routeros_api.h not found)"])
fi
if test "x$with_librouteros" = "xyes"
then
if test "$?" != "0"
then
with_libstatgrab_pkg_config="no"
- with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
+ with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
temp_result="not found"
fi
AC_MSG_RESULT([$temp_result])
$PKG_CONFIG --exists 'libupsclient' 2>/dev/null
if test $? -ne 0
then
- with_libupsclient="no (pkg-config doesn't know library)"
+ with_libupsclient="no (pkg-config doesn't know libupsclient)"
fi
fi
if test "x$with_libupsclient" = "xuse_pkgconfig"
AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
# }}}
+# --with-libvarnish {{{
+with_libvarnish_cppflags=""
+with_libvarnish_cflags=""
+with_libvarnish_libs=""
+AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
+[
+ if test "x$withval" = "xno"
+ then
+ with_libvarnish="no"
+ else if test "x$withval" = "xyes"
+ then
+ with_libvarnish="use_pkgconfig"
+ else if test -d "$with_libvarnish/lib"
+ then
+ AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
+ with_libvarnish_cflags="-I$withval/include"
+ with_libvarnish_libs="-L$withval/lib -lvarnishapi"
+ with_libvarnish="yes"
+ fi; fi; fi
+],
+[with_libvarnish="use_pkgconfig"])
+
+# configure using pkg-config
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
+ if test "x$PKG_CONFIG" = "x"
+ then
+ with_libvarnish="no (Don't have pkg-config)"
+ fi
+fi
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
+ AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
+ $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
+ if test $? -ne 0
+ then
+ with_libvarnish="no (pkg-config doesn't know varnishapi)"
+ fi
+fi
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
+ with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
+ if test $? -ne 0
+ then
+ with_libvarnish="no ($PKG_CONFIG failed)"
+ fi
+ with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
+ if test $? -ne 0
+ then
+ with_libvarnish="no ($PKG_CONFIG failed)"
+ fi
+fi
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
+ with_libvarnish="yes"
+fi
+
+# with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
+# the actual checks.
+if test "x$with_libvarnish" = "xyes"
+then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
+ AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+if test "x$with_libvarnish" = "xyes"
+then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ #SAVE_LDFLAGS="$LDFLAGS"
+
+ CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
+ #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
+
+ AC_CHECK_LIB(varnishapi, VSL_OpenStats,
+ [with_libvarnish="yes"],
+ [with_libvarnish="no (symbol VSL_OpenStats not found)"],
+ [$with_libvarnish_libs])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ #LDFLAGS="$SAVE_LDFLAGS"
+fi
+if test "x$with_libvarnish" = "xyes"
+then
+ BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
+ BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
+ AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
+ AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
+fi
+# }}}
+
# pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
with_libxml2="no (pkg-config isn't available)"
with_libxml2_cflags=""
then
with_libxml2="yes"
else
- with_libxml2="no (pkg-config doesn't know library)"
+ with_libxml2="no (pkg-config doesn't know libxml-2.0)"
fi
pkg-config --exists libvirt 2>/dev/null
then
with_libvirt="yes"
else
- with_libvirt="no (pkg-config doesn't know library)"
+ with_libvirt="no (pkg-config doesn't know libvirt)"
fi
fi
if test "x$with_libxml2" = "xyes"
$PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
if test "$?" != "0"
then
- with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
+ with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
fi
AC_MSG_RESULT([$with_libopenipmipthread])
fi
PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
[with_libnotify="yes"],
- [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
+ [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
+ with_libnotify="no"
+ else
+ with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
+ fi])
# Check for enabled/disabled features
#
plugin_tape="yes"
fi
-if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
-then
- plugin_swap="yes"
-fi
-
# libstatgrab
if test "x$with_libstatgrab" = "xyes"
then
if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
then
plugin_ascent="yes"
- plugin_bind="yes"
+ if test "x$have_strptime" = "xyes"
+ then
+ plugin_bind="yes"
+ fi
fi
if test "x$with_libopenipmipthread" = "xyes"
then
plugin_cpu="yes"
plugin_memory="yes"
- plugin_swap="yes"
plugin_uptime="yes"
+ if test "x$ac_system" = "xDarwin"
+ then
+ plugin_swap="yes"
+ fi
fi
if test "x$have_sysctlbyname" = "xyes"
then
+ plugin_contextswitch="yes"
plugin_cpu="yes"
plugin_memory="yes"
plugin_tcpconns="yes"
plugin_swap="yes"
fi
-if test "x$have_swapctl" = "xyes"
+if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
then
plugin_swap="yes"
fi
m4_divert_once([HELP_ENABLE], [])
+AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP 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's hardware sensors])
AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
AC_PLUGIN([load], [$plugin_load], [System load])
AC_PLUGIN([logfile], [yes], [File logging plugin])
+AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions 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([processes], [$plugin_processes], [Process statistics])
AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
+AC_PLUGIN([redis], [$with_libcredis], [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([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([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([vmem], [$plugin_vmem], [Virtual memory statistics])
AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
+AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
Libraries:
libcurl . . . . . . . $with_libcurl
libdbi . . . . . . . $with_libdbi
+ libcredis . . . . . . $with_libcredis
libesmtp . . . . . . $with_libesmtp
libganglia . . . . . $with_libganglia
libgcrypt . . . . . . $with_libgcrypt
libperl . . . . . . . $with_libperl
libpq . . . . . . . . $with_libpq
libpthread . . . . . $with_libpthread
+ librabbitmq . . . . . $with_librabbitmq
librouteros . . . . . $with_librouteros
librrd . . . . . . . $with_librrd
libsensors . . . . . $with_libsensors
libstatgrab . . . . . $with_libstatgrab
libtokyotyrant . . . $with_libtokyotyrant
libupsclient . . . . $with_libupsclient
+ libvarnish . . . . . $with_libvarnish
libvirt . . . . . . . $with_libvirt
libxml2 . . . . . . . $with_libxml2
libxmms . . . . . . . $with_libxmms
perl . . . . . . . . $with_perl_bindings
Modules:
+ amqp . . . . . . . $enable_amqp
apache . . . . . . . $enable_apache
apcups . . . . . . . $enable_apcups
apple_sensors . . . . $enable_apple_sensors
libvirt . . . . . . . $enable_libvirt
load . . . . . . . . $enable_load
logfile . . . . . . . $enable_logfile
+ lpar... . . . . . . . $enable_lpar
madwifi . . . . . . . $enable_madwifi
match_empty_counter . $enable_match_empty_counter
match_hashed . . . . $enable_match_hashed
processes . . . . . . $enable_processes
protocols . . . . . . $enable_protocols
python . . . . . . . $enable_python
+ redis . . . . . . . . $enable_redis
routeros . . . . . . $enable_routeros
rrdcached . . . . . . $enable_rrdcached
rrdtool . . . . . . . $enable_rrdtool
target_replace . . . $enable_target_replace
target_scale . . . . $enable_target_scale
target_set . . . . . $enable_target_set
+ target_v5upgrade . . $enable_target_v5upgrade
tcpconns . . . . . . $enable_tcpconns
teamspeak2 . . . . . $enable_teamspeak2
ted . . . . . . . . . $enable_ted
thermal . . . . . . . $enable_thermal
+ threshold . . . . . . $enable_threshold
tokyotyrant . . . . . $enable_tokyotyrant
unixsock . . . . . . $enable_unixsock
uptime . . . . . . . $enable_uptime
users . . . . . . . . $enable_users
uuid . . . . . . . . $enable_uuid
+ varnish . . . . . . . $enable_varnish
vmem . . . . . . . . $enable_vmem
vserver . . . . . . . $enable_vserver
wireless . . . . . . $enable_wireless
write_http . . . . . $enable_write_http
+ write_redis . . . . . $enable_write_redis
xmms . . . . . . . . $enable_xmms
zfs_arc . . . . . . . $enable_zfs_arc
AM_CPPFLAGS += -DPKGDATADIR='"${pkgdatadir}"'
sbin_PROGRAMS = collectd collectdmon
-bin_PROGRAMS = collectd-nagios
+bin_PROGRAMS = collectd-nagios collectdctl
collectd_SOURCES = collectd.c collectd.h \
common.c common.h \
utils_match.c utils_match.h \
utils_subst.c utils_subst.h \
utils_tail.c utils_tail.h \
- utils_threshold.c utils_threshold.h \
+ utils_time.c utils_time.h \
types_list.c types_list.h
collectd_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL)
collectd_nagios_LDADD += libcollectdclient/libcollectdclient.la
collectd_nagios_DEPENDENCIES = libcollectdclient/libcollectdclient.la
+
+collectdctl_SOURCES = collectdctl.c
+collectdctl_LDADD =
+if BUILD_WITH_LIBSOCKET
+collectdctl_LDADD += -lsocket
+endif
+if BUILD_AIX
+collectdctl_LDADD += -lm
+endif
+collectdctl_LDADD += libcollectdclient/libcollectdclient.la
+collectdctl_DEPENDENCIES = libcollectdclient/libcollectdclient.la
+
+
pkglib_LTLIBRARIES =
BUILT_SOURCES =
CLEANFILES =
+if BUILD_PLUGIN_AMQP
+pkglib_LTLIBRARIES += amqp.la
+amqp_la_SOURCES = amqp.c \
+ utils_cmd_putval.c utils_cmd_putval.h \
+ utils_format_json.c utils_format_json.h
+amqp_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
+amqp_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
+amqp_la_LIBADD = $(BUILD_WITH_LIBRABBITMQ_LIBS)
+collectd_LDADD += "-dlopen" amqp.la
+collectd_DEPENDENCIES += amqp.la
+endif
+
if BUILD_PLUGIN_APACHE
pkglib_LTLIBRARIES += apache.la
apache_la_SOURCES = apache.c
collectd_DEPENDENCIES += logfile.la
endif
+if BUILD_PLUGIN_LPAR
+pkglib_LTLIBRARIES += lpar.la
+lpar_la_SOURCES = lpar.c
+lpar_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" lpar.la
+collectd_DEPENDENCIES += lpar.la
+lpar_la_LIBADD = -lperfstat
+endif
+
if BUILD_PLUGIN_MADWIFI
pkglib_LTLIBRARIES += madwifi.la
madwifi_la_SOURCES = madwifi.c madwifi.h
collectd_DEPENDENCIES += protocols.la
endif
+if BUILD_PLUGIN_REDIS
+pkglib_LTLIBRARIES += redis.la
+redis_la_SOURCES = redis.c
+redis_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBCREDIS_LDFLAGS)
+redis_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBCREDIS_CPPFLAGS)
+redis_la_LIBADD = -lcredis
+collectd_LDADD += "-dlopen" redis.la
+collectd_DEPENDENCIES += redis.la
+endif
+
if BUILD_PLUGIN_ROUTEROS
pkglib_LTLIBRARIES += routeros.la
routeros_la_SOURCES = routeros.c
collectd_DEPENDENCIES += target_set.la
endif
+if BUILD_PLUGIN_TARGET_V5UPGRADE
+pkglib_LTLIBRARIES += target_v5upgrade.la
+target_v5upgrade_la_SOURCES = target_v5upgrade.c
+target_v5upgrade_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" target_v5upgrade.la
+collectd_DEPENDENCIES += target_v5upgrade.la
+endif
+
if BUILD_PLUGIN_TCPCONNS
pkglib_LTLIBRARIES += tcpconns.la
tcpconns_la_SOURCES = tcpconns.c
collectd_DEPENDENCIES += thermal.la
endif
+if BUILD_PLUGIN_THRESHOLD
+pkglib_LTLIBRARIES += threshold.la
+threshold_la_SOURCES = threshold.c
+threshold_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" threshold.la
+collectd_DEPENDENCIES += threshold.la
+endif
+
if BUILD_PLUGIN_TOKYOTYRANT
pkglib_LTLIBRARIES += tokyotyrant.la
tokyotyrant_la_SOURCES = tokyotyrant.c
unixsock_la_SOURCES = unixsock.c \
utils_cmd_flush.h utils_cmd_flush.c \
utils_cmd_getval.h utils_cmd_getval.c \
- utils_cmd_getthreshold.h utils_cmd_getthreshold.c \
utils_cmd_listval.h utils_cmd_listval.c \
utils_cmd_putval.h utils_cmd_putval.c \
utils_cmd_putnotif.h utils_cmd_putnotif.c
collectd_DEPENDENCIES += uuid.la
endif
+if BUILD_PLUGIN_VARNISH
+pkglib_LTLIBRARIES += varnish.la
+varnish_la_SOURCES = varnish.c
+varnish_la_LDFLAGS = -module -avoid-version
+varnish_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBVARNISH_CFLAGS)
+varnish_la_LIBADD = $(BUILD_WITH_LIBVARNISH_LIBS)
+collectd_LDADD += "-dlopen" varnish.la
+collectd_DEPENDENCIES += varnish.la
+endif
+
if BUILD_PLUGIN_VMEM
pkglib_LTLIBRARIES += vmem.la
vmem_la_SOURCES = vmem.c
collectd_DEPENDENCIES += write_http.la
endif
+if BUILD_PLUGIN_WRITE_REDIS
+pkglib_LTLIBRARIES += write_redis.la
+write_redis_la_SOURCES = write_redis.c
+write_redis_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBCREDIS_LDFLAGS)
+write_redis_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBCREDIS_CPPFLAGS)
+write_redis_la_LIBADD = -lcredis
+collectd_LDADD += "-dlopen" write_redis.la
+collectd_DEPENDENCIES += write_redis.la
+endif
+
if BUILD_PLUGIN_XMMS
pkglib_LTLIBRARIES += xmms.la
xmms_la_SOURCES = xmms.c
collectd_DEPENDENCIES += zfs_arc.la
endif
+ BUILT_SOURCES += $(dist_man_MANS)
+
dist_man_MANS = collectd.1 \
collectd.conf.5 \
collectd-email.5 \
collectd-exec.5 \
+ collectdctl.1 \
collectd-java.5 \
collectdmon.1 \
collectd-nagios.1 \
collectd-perl.5 \
collectd-python.5 \
collectd-snmp.5 \
+ collectd-threshold.5 \
collectd-unixsock.5 \
types.db.5
EXTRA_DIST += collectd.conf.pod \
collectd-email.pod \
collectd-exec.pod \
+ collectdctl.pod \
collectd-java.pod \
collectdmon.pod \
collectd-nagios.pod \
collectd-python.pod \
collectd.pod \
collectd-snmp.pod \
+ collectd-threshold.pod \
collectd-unixsock.pod \
postgresql_default.conf \
types.db.pod
fi
pinba.pb-c.c pinba.pb-c.h: pinba.proto
- protoc-c --c_out $(builddir) pinba.proto
+ protoc-c --c_out . pinba.proto
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
/**
* collectd - src/netlink.c
- * Copyright (C) 2007 Florian octo Forster
+ * Copyright (C) 2007-2010 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
**/
#include "collectd.h"
} /* int check_ignorelist */
static void submit_one (const char *dev, const char *type,
- const char *type_instance, counter_t value)
+ const char *type_instance, derive_t value)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- values[0].counter = value;
+ values[0].derive = value;
vl.values = values;
vl.values_len = 1;
static void submit_two (const char *dev, const char *type,
const char *type_instance,
- counter_t rx, counter_t tx)
+ derive_t rx, derive_t tx)
{
value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
- values[0].counter = rx;
- values[1].counter = tx;
+ values[0].derive = rx;
+ values[1].derive = tx;
vl.values = values;
vl.values_len = 2;
msg = NLMSG_DATA (nmh);
- msg_len = nmh->nlmsg_len - sizeof (struct ifinfomsg);
+ msg_len = nmh->nlmsg_len - NLMSG_LENGTH(sizeof (struct ifinfomsg));
if (msg_len < 0)
{
ERROR ("netlink plugin: link_filter: msg_len = %i < 0;", msg_len);
static int ir_read (void)
{
- struct ifinfomsg im;
struct tcmsg tm;
int ifindex;
static const int type_id[] = { RTM_GETQDISC, RTM_GETTCLASS, RTM_GETTFILTER };
static const char *type_name[] = { "qdisc", "class", "filter" };
- memset (&im, '\0', sizeof (im));
- im.ifi_type = AF_UNSPEC;
-
- if (rtnl_dump_request (&rth, RTM_GETLINK, &im, sizeof (im)) < 0)
+ if (rtnl_wilddump_request (&rth, AF_UNSPEC, RTM_GETLINK) < 0)
{
- ERROR ("netlink plugin: ir_read: rtnl_dump_request failed.");
+ ERROR ("netlink plugin: ir_read: rtnl_wilddump_request failed.");
return (-1);
}
/**
* collectd - src/network.c
- * Copyright (C) 2005-2009 Florian octo Forster
+ * Copyright (C) 2005-2010 Florian octo Forster
* Copyright (C) 2009 Aman Gupta
*
* This program is free software; you can redistribute it and/or modify it
* Private variables
*/
static int network_config_ttl = 0;
-static size_t network_config_packet_size = 1024;
+/* Ethernet - (IPv6 + UDP) = 1500 - (40 + 8) = 1452 */
+static size_t network_config_packet_size = 1452;
static int network_config_forward = 0;
static int network_config_stats = 0;
* example). Only if neither is true, the stats_lock is acquired. The counters
* are always read without holding a lock in the hope that writing 8 bytes to
* memory is an atomic operation. */
-static uint64_t stats_octets_rx = 0;
-static uint64_t stats_octets_tx = 0;
-static uint64_t stats_packets_rx = 0;
-static uint64_t stats_packets_tx = 0;
-static uint64_t stats_values_dispatched = 0;
-static uint64_t stats_values_not_dispatched = 0;
-static uint64_t stats_values_sent = 0;
-static uint64_t stats_values_not_sent = 0;
+static derive_t stats_octets_rx = 0;
+static derive_t stats_octets_tx = 0;
+static derive_t stats_packets_rx = 0;
+static derive_t stats_packets_tx = 0;
+static derive_t stats_values_dispatched = 0;
+static derive_t stats_values_not_dispatched = 0;
+static derive_t stats_values_sent = 0;
+static derive_t stats_values_not_sent = 0;
static pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER;
/*
/* This is a value we already sent. Don't allow it to be received again in
* order to avoid looping. */
if ((status == 0) && (time_sent >= ((uint64_t) vl->time)))
- return (false);
+ return (0);
- return (true);
+ return (1);
} /* }}} _Bool check_receive_okay */
static _Bool check_send_okay (const value_list_t *vl) /* {{{ */
{
- _Bool received = false;
+ _Bool received = 0;
int status;
if (network_config_forward != 0)
- return (true);
+ return (1);
if (vl->meta == NULL)
- return (true);
+ return (1);
status = meta_data_get_boolean (vl->meta, "network:received", &received);
if (status == -ENOENT)
- return (true);
+ return (1);
else if (status != 0)
{
ERROR ("network plugin: check_send_okay: meta_data_get_boolean failed "
"with status %i.", status);
- return (true);
+ return (1);
}
/* By default, only *send* value lists that were not *received* by the
return (-ENOMEM);
}
- status = meta_data_add_boolean (vl->meta, "network:received", true);
+ status = meta_data_add_boolean (vl->meta, "network:received", 1);
if (status != 0)
{
ERROR ("network plugin: meta_data_add_boolean failed.");
&tmp);
if (status == 0)
{
- vl.time = (time_t) tmp;
- n.time = (time_t) tmp;
+ vl.time = TIME_T_TO_CDTIME_T (tmp);
+ n.time = TIME_T_TO_CDTIME_T (tmp);
+ }
+ }
+ else if (pkg_type == TYPE_TIME_HR)
+ {
+ uint64_t tmp = 0;
+ status = parse_part_number (&buffer, &buffer_size,
+ &tmp);
+ if (status == 0)
+ {
+ vl.time = (cdtime_t) tmp;
+ n.time = (cdtime_t) tmp;
}
}
else if (pkg_type == TYPE_INTERVAL)
status = parse_part_number (&buffer, &buffer_size,
&tmp);
if (status == 0)
- vl.interval = (int) tmp;
+ vl.interval = TIME_T_TO_CDTIME_T (tmp);
+ }
+ else if (pkg_type == TYPE_INTERVAL_HR)
+ {
+ uint64_t tmp = 0;
+ status = parse_part_number (&buffer, &buffer_size,
+ &tmp);
+ if (status == 0)
+ vl.interval = (cdtime_t) tmp;
}
else if (pkg_type == TYPE_HOST)
{
if (vl_def->time != vl->time)
{
- if (write_part_number (&buffer, &buffer_size, TYPE_TIME,
+ if (write_part_number (&buffer, &buffer_size, TYPE_TIME_HR,
(uint64_t) vl->time))
return (-1);
vl_def->time = vl->time;
if (vl_def->interval != vl->interval)
{
- if (write_part_number (&buffer, &buffer_size, TYPE_INTERVAL,
+ if (write_part_number (&buffer, &buffer_size, TYPE_INTERVAL_HR,
(uint64_t) vl->interval))
return (-1);
vl_def->interval = vl->interval;
network_config_set_boolean (child, &network_config_forward);
else if (strcasecmp ("ReportStats", child->key) == 0)
network_config_set_boolean (child, &network_config_stats);
- else if (strcasecmp ("CacheFlush", child->key) == 0)
- /* no op for backwards compatibility only */;
else
{
WARNING ("network plugin: Option `%s' is not allowed here.",
memset (buffer, 0, sizeof (buffer));
- status = write_part_number (&buffer_ptr, &buffer_free, TYPE_TIME,
+ status = write_part_number (&buffer_ptr, &buffer_free, TYPE_TIME_HR,
(uint64_t) n->time);
if (status != 0)
return (-1);
static int network_stats_read (void) /* {{{ */
{
- uint64_t copy_octets_rx;
- uint64_t copy_octets_tx;
- uint64_t copy_packets_rx;
- uint64_t copy_packets_tx;
- uint64_t copy_values_dispatched;
- uint64_t copy_values_not_dispatched;
- uint64_t copy_values_sent;
- uint64_t copy_values_not_sent;
- uint64_t copy_receive_list_length;
+ derive_t copy_octets_rx;
+ derive_t copy_octets_tx;
+ derive_t copy_packets_rx;
+ derive_t copy_packets_tx;
+ derive_t copy_values_dispatched;
+ derive_t copy_values_not_dispatched;
+ derive_t copy_values_sent;
+ derive_t copy_values_not_sent;
+ derive_t copy_receive_list_length;
value_list_t vl = VALUE_LIST_INIT;
value_t values[2];
sstrncpy (vl.plugin, "network", sizeof (vl.plugin));
/* Octets received / sent */
- vl.values[0].counter = (counter_t) copy_octets_rx;
- vl.values[1].counter = (counter_t) copy_octets_tx;
+ vl.values[0].derive = (derive_t) copy_octets_rx;
+ vl.values[1].derive = (derive_t) copy_octets_tx;
sstrncpy (vl.type, "if_octets", sizeof (vl.type));
plugin_dispatch_values_secure (&vl);
/* Packets received / send */
- vl.values[0].counter = (counter_t) copy_packets_rx;
- vl.values[1].counter = (counter_t) copy_packets_tx;
+ vl.values[0].derive = (derive_t) copy_packets_rx;
+ vl.values[1].derive = (derive_t) copy_packets_tx;
sstrncpy (vl.type, "if_packets", sizeof (vl.type));
plugin_dispatch_values_secure (&vl);
static int network_init (void)
{
- static _Bool have_init = false;
+ static _Bool have_init = 0;
/* Check if we were already initialized. If so, just return - there's
* nothing more to do (for now, that is). */
if (have_init)
return (0);
- have_init = true;
+ have_init = 1;
#if HAVE_LIBGCRYPT
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
- gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
- gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+ /* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
+ * Because you can't know in a library whether another library has
+ * already initialized the library
+ */
+ if (!gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
+ {
+ gcry_check_version(NULL); /* before calling any other functions */
+ gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+ }
#endif
if (network_config_stats != 0)
* just send the buffer if `flush' is called - if the requested value was in
* there, good. If not, well, then there is nothing to flush.. -octo
*/
-static int network_flush (int timeout,
- const char __attribute__((unused)) *identifier,
- user_data_t __attribute__((unused)) *user_data)
+static int network_flush (__attribute__((unused)) cdtime_t timeout,
+ __attribute__((unused)) const char *identifier,
+ __attribute__((unused)) user_data_t *user_data)
{
pthread_mutex_lock (&send_buffer_lock);
Py_END_ALLOW_THREADS
Py_XDECREF(tn);
Py_XDECREF(m);
- if (!cpy_format_exception) {
+ if (!cpy_format_exception || !traceback) {
PyErr_Clear();
- Py_XDECREF(type);
+ Py_DECREF(type);
Py_XDECREF(value);
Py_XDECREF(traceback);
return;
}
- if (!traceback) {
- PyErr_Clear();
- return;
- }
list = PyObject_CallFunction(cpy_format_exception, "NNN", type, value, traceback); /* New reference. */
if (list)
l = PyObject_Length(list);
}
Py_XDECREF(list);
PyErr_Clear();
+ Py_DECREF(type);
+ Py_XDECREF(value);
+ Py_XDECREF(traceback);
}
static int cpy_read_callback(user_data_t *data) {
static int cpy_write_callback(const data_set_t *ds, const value_list_t *value_list, user_data_t *data) {
int i;
cpy_callback_t *c = data->data;
- PyObject *ret, *list, *temp, *dict = NULL, *val;
+ PyObject *ret, *list, *temp, *dict = NULL;
Values *v;
CPY_LOCK_THREADS
CPY_RETURN_FROM_THREADS 0;
}
}
- dict = PyDict_New();
+ dict = PyDict_New(); /* New reference. */
if (value_list->meta) {
int i, num;
char **table;
if (type == MD_TYPE_STRING) {
if (meta_data_get_string(meta, table[i], &string))
continue;
- temp = cpy_string_to_unicode_or_bytes(string);
+ temp = cpy_string_to_unicode_or_bytes(string); /* New reference. */
free(string);
PyDict_SetItemString(dict, table[i], temp);
Py_XDECREF(temp);
} else if (type == MD_TYPE_SIGNED_INT) {
if (meta_data_get_signed_int(meta, table[i], &si))
continue;
- temp = PyObject_CallFunctionObjArgs((void *) &SignedType, PyLong_FromLongLong(si), (void *) 0);
+ temp = PyObject_CallFunctionObjArgs((void *) &SignedType, PyLong_FromLongLong(si), (void *) 0); /* New reference. */
PyDict_SetItemString(dict, table[i], temp);
Py_XDECREF(temp);
} else if (type == MD_TYPE_UNSIGNED_INT) {
if (meta_data_get_unsigned_int(meta, table[i], &ui))
continue;
- temp = PyObject_CallFunctionObjArgs((void *) &UnsignedType, PyLong_FromUnsignedLongLong(ui), (void *) 0);
+ temp = PyObject_CallFunctionObjArgs((void *) &UnsignedType, PyLong_FromUnsignedLongLong(ui), (void *) 0); /* New reference. */
PyDict_SetItemString(dict, table[i], temp);
Py_XDECREF(temp);
} else if (type == MD_TYPE_DOUBLE) {
if (meta_data_get_double(meta, table[i], &d))
continue;
- temp = PyFloat_FromDouble(d);
+ temp = PyFloat_FromDouble(d); /* New reference. */
PyDict_SetItemString(dict, table[i], temp);
Py_XDECREF(temp);
} else if (type == MD_TYPE_BOOLEAN) {
}
free(table);
}
- val = Values_New(); /* New reference. */
- v = (Values *) val;
+ v = (Values *) Values_New(); /* New reference. */
sstrncpy(v->data.host, value_list->host, sizeof(v->data.host));
sstrncpy(v->data.type, value_list->type, sizeof(v->data.type));
sstrncpy(v->data.type_instance, value_list->type_instance, sizeof(v->data.type_instance));
sstrncpy(v->data.plugin, value_list->plugin, sizeof(v->data.plugin));
sstrncpy(v->data.plugin_instance, value_list->plugin_instance, sizeof(v->data.plugin_instance));
- v->data.time = value_list->time;
- v->interval = value_list->interval;
+ v->data.time = CDTIME_T_TO_DOUBLE(value_list->time);
+ v->interval = CDTIME_T_TO_DOUBLE(value_list->interval);
Py_CLEAR(v->values);
v->values = list;
Py_CLEAR(v->meta);
- v->meta = dict;
+ v->meta = dict; /* Steals a reference. */
ret = PyObject_CallFunctionObjArgs(c->callback, v, c->data, (void *) 0); /* New reference. */
- Py_XDECREF(val);
+ Py_XDECREF(v);
if (ret == NULL) {
cpy_log_exception("write callback");
} else {
sstrncpy(n->data.type_instance, notification->type_instance, sizeof(n->data.type_instance));
sstrncpy(n->data.plugin, notification->plugin, sizeof(n->data.plugin));
sstrncpy(n->data.plugin_instance, notification->plugin_instance, sizeof(n->data.plugin_instance));
- n->data.time = notification->time;
+ n->data.time = CDTIME_T_TO_DOUBLE(notification->time);
sstrncpy(n->message, notification->message, sizeof(n->message));
n->severity = notification->severity;
ret = PyObject_CallFunctionObjArgs(c->callback, n, c->data, (void *) 0); /* New reference. */
PyObject *ret, *text;
CPY_LOCK_THREADS
- text = cpy_string_to_unicode_or_bytes(message);
+ text = cpy_string_to_unicode_or_bytes(message); /* New reference. */
if (c->data == NULL)
- ret = PyObject_CallFunction(c->callback, "iN", severity, text); /* New reference. */
+ ret = PyObject_CallFunction(c->callback, "iN", severity, text); /* New reference. Steals a reference from "text". */
else
- ret = PyObject_CallFunction(c->callback, "iNO", severity, text, c->data); /* New reference. */
+ ret = PyObject_CallFunction(c->callback, "iNO", severity, text, c->data); /* New reference. Steals a reference from "text". */
if (ret == NULL) {
/* FIXME */
static PyObject *cpy_register_generic(cpy_callback_t **list_head, PyObject *args, PyObject *kwds) {
char buf[512];
cpy_callback_t *c;
- const char *name = NULL;
+ char *name = NULL;
PyObject *callback = NULL, *data = NULL, *mod = NULL;
static char *kwlist[] = {"callback", "data", "name", NULL};
if (PyArg_ParseTupleAndKeywords(args, kwds, "O|Oet", kwlist, &callback, &data, NULL, &name) == 0) return NULL;
if (PyCallable_Check(callback) == 0) {
+ PyMem_Free(name);
PyErr_SetString(PyExc_TypeError, "callback needs a be a callable object.");
return NULL;
}
c->next = *list_head;
*list_head = c;
Py_XDECREF(mod);
+ PyMem_Free(name);
return cpy_string_to_unicode_or_bytes(buf);
}
static PyObject *cpy_flush(cpy_callback_t **list_head, PyObject *args, PyObject *kwds) {
int timeout = -1;
- const char *plugin = NULL, *identifier = NULL;
+ char *plugin = NULL, *identifier = NULL;
static char *kwlist[] = {"plugin", "timeout", "identifier", NULL};
if (PyArg_ParseTupleAndKeywords(args, kwds, "|etiet", kwlist, NULL, &plugin, &timeout, NULL, &identifier) == 0) return NULL;
Py_BEGIN_ALLOW_THREADS
plugin_flush(plugin, timeout, identifier);
Py_END_ALLOW_THREADS
+ PyMem_Free(plugin);
+ PyMem_Free(identifier);
Py_RETURN_NONE;
}
reg_function_t *register_function = (reg_function_t *) reg;
cpy_callback_t *c = NULL;
user_data_t *user_data = NULL;
- const char *name = NULL;
+ char *name = NULL;
PyObject *callback = NULL, *data = NULL;
static char *kwlist[] = {"callback", "data", "name", NULL};
if (PyArg_ParseTupleAndKeywords(args, kwds, "O|Oet", kwlist, &callback, &data, NULL, &name) == 0) return NULL;
if (PyCallable_Check(callback) == 0) {
+ PyMem_Free(name);
PyErr_SetString(PyExc_TypeError, "callback needs a be a callable object.");
return NULL;
}
cpy_build_name(buf, sizeof(buf), callback, name);
+ PyMem_Free(name);
Py_INCREF(callback);
Py_XINCREF(data);
cpy_callback_t *c = NULL;
user_data_t *user_data = NULL;
double interval = 0;
- const char *name = NULL;
+ char *name = NULL;
PyObject *callback = NULL, *data = NULL;
struct timespec ts;
static char *kwlist[] = {"callback", "interval", "data", "name", NULL};
if (PyArg_ParseTupleAndKeywords(args, kwds, "O|dOet", kwlist, &callback, &interval, &data, NULL, &name) == 0) return NULL;
if (PyCallable_Check(callback) == 0) {
+ PyMem_Free(name);
PyErr_SetString(PyExc_TypeError, "callback needs a be a callable object.");
return NULL;
}
cpy_build_name(buf, sizeof(buf), callback, name);
+ PyMem_Free(name);
Py_INCREF(callback);
Py_XINCREF(data);
}
static PyObject *cpy_error(PyObject *self, PyObject *args) {
- const char *text;
+ char *text;
if (PyArg_ParseTuple(args, "et", NULL, &text) == 0) return NULL;
Py_BEGIN_ALLOW_THREADS
plugin_log(LOG_ERR, "%s", text);
Py_END_ALLOW_THREADS
+ PyMem_Free(text);
Py_RETURN_NONE;
}
static PyObject *cpy_warning(PyObject *self, PyObject *args) {
- const char *text;
+ char *text;
if (PyArg_ParseTuple(args, "et", NULL, &text) == 0) return NULL;
Py_BEGIN_ALLOW_THREADS
plugin_log(LOG_WARNING, "%s", text);
Py_END_ALLOW_THREADS
+ PyMem_Free(text);
Py_RETURN_NONE;
}
static PyObject *cpy_notice(PyObject *self, PyObject *args) {
- const char *text;
+ char *text;
if (PyArg_ParseTuple(args, "et", NULL, &text) == 0) return NULL;
Py_BEGIN_ALLOW_THREADS
plugin_log(LOG_NOTICE, "%s", text);
Py_END_ALLOW_THREADS
+ PyMem_Free(text);
Py_RETURN_NONE;
}
static PyObject *cpy_info(PyObject *self, PyObject *args) {
- const char *text;
+ char *text;
if (PyArg_ParseTuple(args, "et", NULL, &text) == 0) return NULL;
Py_BEGIN_ALLOW_THREADS
plugin_log(LOG_INFO, "%s", text);
Py_END_ALLOW_THREADS
+ PyMem_Free(text);
Py_RETURN_NONE;
}
static PyObject *cpy_debug(PyObject *self, PyObject *args) {
#ifdef COLLECT_DEBUG
- const char *text;
+ char *text;
if (PyArg_ParseTuple(args, "et", NULL, &text) == 0) return NULL;
Py_BEGIN_ALLOW_THREADS
plugin_log(LOG_DEBUG, "%s", text);
Py_END_ALLOW_THREADS
+ PyMem_Free(text);
#endif
Py_RETURN_NONE;
}
#include "cpython.h"
+ #define FreeAll() do {\
+ PyMem_Free(type);\
+ PyMem_Free(plugin_instance);\
+ PyMem_Free(type_instance);\
+ PyMem_Free(plugin);\
+ PyMem_Free(host);\
+ } while(0)
+
static PyObject *cpy_common_repr(PyObject *s) {
PyObject *ret, *tmp;
static PyObject *l_type = NULL, *l_type_instance = NULL, *l_plugin = NULL, *l_plugin_instance = NULL;
if (self->time != 0) {
CPY_STRCAT(&ret, l_time);
- tmp = PyInt_FromLong(self->time);
+ tmp = PyFloat_FromDouble(self->time);
CPY_SUBSTITUTE(PyObject_Repr, tmp, tmp);
CPY_STRCAT_AND_DEL(&ret, tmp);
}
static int PluginData_init(PyObject *s, PyObject *args, PyObject *kwds) {
PluginData *self = (PluginData *) s;
double time = 0;
- const char *type = "", *plugin_instance = "", *type_instance = "", *plugin = "", *host = "";
+ char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL;
static char *kwlist[] = {"type", "plugin_instance", "type_instance",
"plugin", "host", "time", NULL};
NULL, &plugin_instance, NULL, &type_instance, NULL, &plugin, NULL, &host, &time))
return -1;
- if (type[0] != 0 && plugin_get_ds(type) == NULL) {
+ if (type && plugin_get_ds(type) == NULL) {
PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
+ FreeAll();
return -1;
}
- sstrncpy(self->host, host, sizeof(self->host));
- sstrncpy(self->plugin, plugin, sizeof(self->plugin));
- sstrncpy(self->plugin_instance, plugin_instance, sizeof(self->plugin_instance));
- sstrncpy(self->type, type, sizeof(self->type));
- sstrncpy(self->type_instance, type_instance, sizeof(self->type_instance));
-
+ sstrncpy(self->host, host ? host : "", sizeof(self->host));
+ sstrncpy(self->plugin, plugin ? plugin : "", sizeof(self->plugin));
+ sstrncpy(self->plugin_instance, plugin_instance ? plugin_instance : "", sizeof(self->plugin_instance));
+ sstrncpy(self->type, type ? type : "", sizeof(self->type));
+ sstrncpy(self->type_instance, type_instance ? type_instance : "", sizeof(self->type_instance));
self->time = time;
+
+ FreeAll();
+
return 0;
}
static int Values_init(PyObject *s, PyObject *args, PyObject *kwds) {
Values *self = (Values *) s;
- int interval = 0;
- double time = 0;
+ double interval = 0, time = 0;
PyObject *values = NULL, *meta = NULL, *tmp;
- const char *type = "", *plugin_instance = "", *type_instance = "", *plugin = "", *host = "";
+ char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL;
static char *kwlist[] = {"type", "values", "plugin_instance", "type_instance",
"plugin", "host", "time", "interval", "meta", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetdiO", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetddO", kwlist,
NULL, &type, &values, NULL, &plugin_instance, NULL, &type_instance,
NULL, &plugin, NULL, &host, &time, &interval, &meta))
return -1;
- if (type[0] != 0 && plugin_get_ds(type) == NULL) {
+ if (type && plugin_get_ds(type) == NULL) {
PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
+ FreeAll();
return -1;
}
- sstrncpy(self->data.host, host, sizeof(self->data.host));
- sstrncpy(self->data.plugin, plugin, sizeof(self->data.plugin));
- sstrncpy(self->data.plugin_instance, plugin_instance, sizeof(self->data.plugin_instance));
- sstrncpy(self->data.type, type, sizeof(self->data.type));
- sstrncpy(self->data.type_instance, type_instance, sizeof(self->data.type_instance));
+ sstrncpy(self->data.host, host ? host : "", sizeof(self->data.host));
+ sstrncpy(self->data.plugin, plugin ? plugin : "", sizeof(self->data.plugin));
+ sstrncpy(self->data.plugin_instance, plugin_instance ? plugin_instance : "", sizeof(self->data.plugin_instance));
+ sstrncpy(self->data.type, type ? type : "", sizeof(self->data.type));
+ sstrncpy(self->data.type_instance, type_instance ? type_instance : "", sizeof(self->data.type_instance));
self->data.time = time;
+ FreeAll();
+
if (values == NULL) {
values = PyList_New(0);
PyErr_Clear();
value_t *value;
value_list_t value_list = VALUE_LIST_INIT;
PyObject *values = self->values, *meta = self->meta;
- double time = self->data.time;
- int interval = self->interval;
+ double time = self->data.time, interval = self->interval;
- const char *host = self->data.host;
- const char *plugin = self->data.plugin;
- const char *plugin_instance = self->data.plugin_instance;
- const char *type = self->data.type;
- const char *type_instance = self->data.type_instance;
+ char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL;
static char *kwlist[] = {"type", "values", "plugin_instance", "type_instance",
"plugin", "host", "time", "interval", "meta", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetdiO", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetddO", kwlist,
NULL, &type, &values, NULL, &plugin_instance, NULL, &type_instance,
NULL, &plugin, NULL, &host, &time, &interval, &meta))
return NULL;
- if (type[0] == 0) {
+ sstrncpy(value_list.host, host ? host : self->data.host, sizeof(value_list.host));
+ sstrncpy(value_list.plugin, plugin ? plugin : self->data.plugin, sizeof(value_list.plugin));
+ sstrncpy(value_list.plugin_instance, plugin_instance ? plugin_instance : self->data.plugin_instance, sizeof(value_list.plugin_instance));
+ sstrncpy(value_list.type, type ? type : self->data.type, sizeof(value_list.type));
+ sstrncpy(value_list.type_instance, type_instance ? type_instance : self->data.type_instance, sizeof(value_list.type_instance));
+ FreeAll();
+ if (value_list.type[0] == 0) {
PyErr_SetString(PyExc_RuntimeError, "type not set");
+ FreeAll();
return NULL;
}
- ds = plugin_get_ds(type);
+ ds = plugin_get_ds(value_list.type);
if (ds == NULL) {
- PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
+ PyErr_Format(PyExc_TypeError, "Dataset %s not found", value_list.type);
return NULL;
}
if (values == NULL || (PyTuple_Check(values) == 0 && PyList_Check(values) == 0)) {
}
size = (int) PySequence_Length(values);
if (size != ds->ds_num) {
- PyErr_Format(PyExc_RuntimeError, "type %s needs %d values, got %i", type, ds->ds_num, size);
+ PyErr_Format(PyExc_RuntimeError, "type %s needs %d values, got %i", value_list.type, ds->ds_num, size);
return NULL;
}
value = malloc(size * sizeof(*value));
}
} else {
free(value);
- PyErr_Format(PyExc_RuntimeError, "unknown data type %d for %s", ds->ds->type, type);
+ PyErr_Format(PyExc_RuntimeError, "unknown data type %d for %s", ds->ds->type, value_list.type);
return NULL;
}
if (PyErr_Occurred() != NULL) {
value_list.values = value;
value_list.meta = cpy_build_meta(meta);
value_list.values_len = size;
- value_list.time = time;
- value_list.interval = interval;
+ value_list.time = DOUBLE_TO_CDTIME_T(time);
+ value_list.interval = DOUBLE_TO_CDTIME_T(interval);
- sstrncpy(value_list.host, host, sizeof(value_list.host));
- sstrncpy(value_list.plugin, plugin, sizeof(value_list.plugin));
- sstrncpy(value_list.plugin_instance, plugin_instance, sizeof(value_list.plugin_instance));
- sstrncpy(value_list.type, type, sizeof(value_list.type));
- sstrncpy(value_list.type_instance, type_instance, sizeof(value_list.type_instance));
if (value_list.host[0] == 0)
sstrncpy(value_list.host, hostname_g, sizeof(value_list.host));
if (value_list.plugin[0] == 0)
value_t *value;
value_list_t value_list = VALUE_LIST_INIT;
PyObject *values = self->values, *meta = self->meta;
- double time = self->data.time;
- int interval = self->interval;
+ double time = self->data.time, interval = self->interval;
- const char *host = self->data.host;
- const char *plugin = self->data.plugin;
- const char *plugin_instance = self->data.plugin_instance;
- const char *type = self->data.type;
- const char *type_instance = self->data.type_instance;
- const char *dest = NULL;
+ char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL, *dest = NULL;
static char *kwlist[] = {"destination", "type", "values", "plugin_instance", "type_instance",
"plugin", "host", "time", "interval", "meta", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|etOetetetetddO", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|etOetetetetdiO", kwlist, NULL, &dest,
NULL, &type, &values, NULL, &plugin_instance, NULL, &type_instance,
NULL, &plugin, NULL, &host, &time, &interval, &meta))
return NULL;
- if (type[0] == 0) {
+ sstrncpy(value_list.host, host ? host : self->data.host, sizeof(value_list.host));
+ sstrncpy(value_list.plugin, plugin ? plugin : self->data.plugin, sizeof(value_list.plugin));
+ sstrncpy(value_list.plugin_instance, plugin_instance ? plugin_instance : self->data.plugin_instance, sizeof(value_list.plugin_instance));
+ sstrncpy(value_list.type, type ? type : self->data.type, sizeof(value_list.type));
+ sstrncpy(value_list.type_instance, type_instance ? type_instance : self->data.type_instance, sizeof(value_list.type_instance));
+ FreeAll();
+ if (value_list.type[0] == 0) {
PyErr_SetString(PyExc_RuntimeError, "type not set");
return NULL;
}
- ds = plugin_get_ds(type);
+ ds = plugin_get_ds(value_list.type);
if (ds == NULL) {
- PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
+ PyErr_Format(PyExc_TypeError, "Dataset %s not found", value_list.type);
return NULL;
}
if (values == NULL || (PyTuple_Check(values) == 0 && PyList_Check(values) == 0)) {
}
size = (int) PySequence_Length(values);
if (size != ds->ds_num) {
- PyErr_Format(PyExc_RuntimeError, "type %s needs %d values, got %i", type, ds->ds_num, size);
+ PyErr_Format(PyExc_RuntimeError, "type %s needs %d values, got %i", value_list.type, ds->ds_num, size);
return NULL;
}
value = malloc(size * sizeof(*value));
}
} else {
free(value);
- PyErr_Format(PyExc_RuntimeError, "unknown data type %d for %s", ds->ds->type, type);
+ PyErr_Format(PyExc_RuntimeError, "unknown data type %d for %s", ds->ds->type, value_list.type);
return NULL;
}
if (PyErr_Occurred() != NULL) {
}
value_list.values = value;
value_list.values_len = size;
- value_list.time = time;
- value_list.interval = interval;
+ value_list.time = DOUBLE_TO_CDTIME_T(time);
+ value_list.interval = DOUBLE_TO_CDTIME_T(interval);
- sstrncpy(value_list.host, host, sizeof(value_list.host));
- sstrncpy(value_list.plugin, plugin, sizeof(value_list.plugin));
- sstrncpy(value_list.plugin_instance, plugin_instance, sizeof(value_list.plugin_instance));
- sstrncpy(value_list.type, type, sizeof(value_list.type));
- sstrncpy(value_list.type_instance, type_instance, sizeof(value_list.type_instance));
value_list.meta = cpy_build_meta(meta);;
if (value_list.host[0] == 0)
sstrncpy(value_list.host, hostname_g, sizeof(value_list.host));
ret = cpy_common_repr(s);
if (self->interval != 0) {
CPY_STRCAT(&ret, l_interval);
- tmp = PyInt_FromLong(self->interval);
+ tmp = PyFloat_FromDouble(self->interval);
CPY_SUBSTITUTE(PyObject_Repr, tmp, tmp);
CPY_STRCAT_AND_DEL(&ret, tmp);
}
Notification *self = (Notification *) s;
int severity = 0;
double time = 0;
- const char *message = "";
- const char *type = "", *plugin_instance = "", *type_instance = "", *plugin = "", *host = "";
+ char *message = NULL;
+ char *type = NULL, *plugin_instance = NULL, *type_instance = NULL, *plugin = NULL, *host = NULL;
static char *kwlist[] = {"type", "message", "plugin_instance", "type_instance",
"plugin", "host", "time", "severity", NULL};
NULL, &plugin, NULL, &host, &time, &severity))
return -1;
- if (type[0] != 0 && plugin_get_ds(type) == NULL) {
+ if (type && plugin_get_ds(type) == NULL) {
PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
+ FreeAll();
+ PyMem_Free(message);
return -1;
}
- sstrncpy(self->data.host, host, sizeof(self->data.host));
- sstrncpy(self->data.plugin, plugin, sizeof(self->data.plugin));
- sstrncpy(self->data.plugin_instance, plugin_instance, sizeof(self->data.plugin_instance));
- sstrncpy(self->data.type, type, sizeof(self->data.type));
- sstrncpy(self->data.type_instance, type_instance, sizeof(self->data.type_instance));
+ sstrncpy(self->data.host, host ? host : "", sizeof(self->data.host));
+ sstrncpy(self->data.plugin, plugin ? plugin : "", sizeof(self->data.plugin));
+ sstrncpy(self->data.plugin_instance, plugin_instance ? plugin_instance : "", sizeof(self->data.plugin_instance));
+ sstrncpy(self->data.type, type ? type : "", sizeof(self->data.type));
+ sstrncpy(self->data.type_instance, type_instance ? type_instance : "", sizeof(self->data.type_instance));
+ sstrncpy(self->message, message ? message : "", sizeof(self->message));
self->data.time = time;
-
- sstrncpy(self->message, message, sizeof(self->message));
self->severity = severity;
+
+ FreeAll();
+ PyMem_Free(message);
return 0;
}
notification_t notification;
double t = self->data.time;
int severity = self->severity;
- const char *host = self->data.host;
- const char *plugin = self->data.plugin;
- const char *plugin_instance = self->data.plugin_instance;
- const char *type = self->data.type;
- const char *type_instance = self->data.type_instance;
- const char *message = self->message;
+ char *host = NULL, *plugin = NULL, *plugin_instance = NULL, *type = NULL, *type_instance = NULL;
+ char *message = NULL;
static char *kwlist[] = {"type", "message", "plugin_instance", "type_instance",
"plugin", "host", "time", "severity", NULL};
NULL, &plugin, NULL, &host, &t, &severity))
return NULL;
- if (type[0] == 0) {
- notification.time = t;
++ notification.time = DOUBLE_TO_CDTIME_T(t);
+ notification.severity = severity;
+ sstrncpy(notification.message, message ? message : self->message, sizeof(notification.message));
+ sstrncpy(notification.host, host ? host : self->data.host, sizeof(notification.host));
+ sstrncpy(notification.plugin, plugin ? plugin : self->data.plugin, sizeof(notification.plugin));
+ sstrncpy(notification.plugin_instance, plugin_instance ? plugin_instance : self->data.plugin_instance, sizeof(notification.plugin_instance));
+ sstrncpy(notification.type, type ? type : self->data.type, sizeof(notification.type));
+ sstrncpy(notification.type_instance, type_instance ? type_instance : self->data.type_instance, sizeof(notification.type_instance));
+ notification.meta = NULL;
+ FreeAll();
+ PyMem_Free(message);
+
+ if (notification.type[0] == 0) {
PyErr_SetString(PyExc_RuntimeError, "type not set");
return NULL;
}
- ds = plugin_get_ds(type);
+ ds = plugin_get_ds(notification.type);
if (ds == NULL) {
- PyErr_Format(PyExc_TypeError, "Dataset %s not found", type);
+ PyErr_Format(PyExc_TypeError, "Dataset %s not found", notification.type);
return NULL;
}
- notification.time = DOUBLE_TO_CDTIME_T(t);
- notification.severity = severity;
- sstrncpy(notification.message, message, sizeof(notification.message));
- sstrncpy(notification.host, host, sizeof(notification.host));
- sstrncpy(notification.plugin, plugin, sizeof(notification.plugin));
- sstrncpy(notification.plugin_instance, plugin_instance, sizeof(notification.plugin_instance));
- sstrncpy(notification.type, type, sizeof(notification.type));
- sstrncpy(notification.type_instance, type_instance, sizeof(notification.type_instance));
- notification.meta = NULL;
- if (notification.time < 1)
- notification.time = time(0);
+ if (notification.time == 0)
+ notification.time = cdtime();
if (notification.host[0] == 0)
sstrncpy(notification.host, hostname_g, sizeof(notification.host));
if (notification.plugin[0] == 0)