From: Florian Forster Date: Tue, 28 Aug 2007 22:02:21 +0000 (+0200) Subject: Merge branch 'collectd-4.0' X-Git-Tag: collectd-4.1.0~27 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=12c1e32ec71ffd5d90af5df4b430fba04d91aed5;hp=-c;p=collectd.git Merge branch 'collectd-4.0' Conflicts: ChangeLog configure.in src/Makefile.am src/collectd-unixsock.pod src/mysql.c src/nut.c --- 12c1e32ec71ffd5d90af5df4b430fba04d91aed5 diff --combined ChangeLog index fcccbf8b,6c9358b6..4bbf5bc4 --- a/ChangeLog +++ b/ChangeLog @@@ -1,19 -1,15 +1,31 @@@ +2007-07-21, Version 4.1.0 + * Build system: The build system has been changed to automatically + disable all plugins, which are missing dependencies. The dependency + checking has been removed from the plugins themselves to remove + redundancy. + * Flexible interval: The interval of collected data is not sent along + with the data itself over the network, so that the interval-settings + of server and clients no longer needs to match. + * snmp plugin: The new `snmp' plugin can read values from SNMP enabled + network devices, such as switches, routers, thermometers, rack + monitoring servers, etc. The collectd-snmp(5) manpage documents this + plugin. + * unixsock plugin: Added the `LISTVAL' command. + * xmms plugin: The new `xmms' plugin graphs the bitrate and frequency + of music played with xmms. + + 2007-08-26, Version 4.0.7 + * documentation: Some typos have been fixed and some information has + been improved. + * build system: Many fixes for detecting libraries in unusual places, + such as on RedHat systems. The affected libraries are `libcurl', + `libmysql', and `libupsclient'. + * network plugin: Allow the `Port' option to be specified as a number + (i. e. without quotes). + * nut plugin: A fix allows linking the nut plugin against + libupsclient, version >= 2.2.0. + * processes plugin: Fix a potential segmentation fault. + 2007-07-30, Version 4.0.6 * sensors plugin: Fix the ignorelist functionality: Only the `type instance' was used to match against the list, but the documentation diff --combined configure.in index 735ea749,14fcaa7f..01c6b952 --- a/configure.in +++ b/configure.in @@@ -1,5 -1,5 +1,5 @@@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(collectd, 4.0.7) +AC_INIT(collectd, m4_esyscmd(./version-gen.sh)) AC_CONFIG_SRCDIR(src/collectd.c) AC_CONFIG_HEADERS(src/config.h) AM_INIT_AUTOMAKE(dist-bzip2) @@@ -36,8 -36,23 +36,8 @@@ AC_CONFIG_SUBDIRS(libltdl AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_DIRENT -AC_CHECK_HEADERS(stdint.h) -AC_CHECK_HEADERS(stdio.h) -AC_CHECK_HEADERS(errno.h) -AC_CHECK_HEADERS(math.h) -AC_CHECK_HEADERS(syslog.h) -AC_CHECK_HEADERS(fcntl.h) -AC_CHECK_HEADERS(signal.h) -AC_CHECK_HEADERS(assert.h) -AC_CHECK_HEADERS(sys/types.h) -AC_CHECK_HEADERS(sys/socket.h) -AC_CHECK_HEADERS(sys/select.h) -AC_CHECK_HEADERS(poll.h) -AC_CHECK_HEADERS(netdb.h) -AC_CHECK_HEADERS(arpa/inet.h) -AC_CHECK_HEADERS(sys/resource.h) -AC_CHECK_HEADERS(sys/param.h) -AC_CHECK_HEADERS(kstat.h) + +AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h) # For ping library AC_CHECK_HEADERS(netinet/in_systm.h, [], [], @@@ -174,7 -189,6 +174,7 @@@ AC_CHECK_HEADERS(netinet/udp.h, [], [] ]) # For cpu modules +AC_CHECK_HEADERS(sys/dkstat.h mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h) AC_CHECK_HEADERS(sys/sysctl.h, [], [], [ #if HAVE_SYS_TYPES_H @@@ -184,12 -198,33 +184,12 @@@ # include #endif ]) -AC_CHECK_HEADERS(sys/dkstat.h) -AC_CHECK_HEADERS(mach/mach_init.h) -AC_CHECK_HEADERS(mach/host_priv.h) -AC_CHECK_HEADERS(mach/mach_error.h) -AC_CHECK_HEADERS(mach/mach_host.h) -AC_CHECK_HEADERS(mach/mach_port.h) -AC_CHECK_HEADERS(mach/mach_types.h) -AC_CHECK_HEADERS(mach/message.h) -AC_CHECK_HEADERS(mach/processor_set.h) -AC_CHECK_HEADERS(mach/processor.h) -AC_CHECK_HEADERS(mach/processor_info.h) -AC_CHECK_HEADERS(mach/task.h) -AC_CHECK_HEADERS(mach/thread_act.h) -AC_CHECK_HEADERS(mach/vm_region.h) -AC_CHECK_HEADERS(mach/vm_map.h) -AC_CHECK_HEADERS(mach/vm_prot.h) -AC_CHECK_HEADERS(mach/vm_statistics.h) -AC_CHECK_HEADERS(mach/kern_return.h) # For hddtemp module -AC_CHECK_HEADERS(linux/major.h) -AC_CHECK_HEADERS(libgen.h) +AC_CHECK_HEADERS(linux/major.h libgen.h) # For the apple_sensors module -AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h) -AC_CHECK_HEADERS(IOKit/IOKitLib.h) -AC_CHECK_HEADERS(IOKit/IOTypes.h) +AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h) # For the battery plugin AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [], @@@ -201,6 -236,17 +201,6 @@@ # include #endif ]) -AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h) - -# For the `disk' plugin -AC_CHECK_HEADERS(IOKit/IOBSD.h) -AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h) - -# For load module -AC_CHECK_HEADERS(sys/loadavg.h) - -# For the processes plugin -AC_CHECK_HEADERS(linux/config.h) # For the swap module AC_CHECK_HEADERS(sys/swap.h, [], [], @@@ -213,10 -259,9 +213,10 @@@ #endif ]) +# For load module +# For the processes plugin # For users module -AC_CHECK_HEADERS(utmp.h) -AC_CHECK_HEADERS(utmpx.h) +AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h) # For interface plugin AC_CHECK_HEADERS(ifaddrs.h) @@@ -251,7 -296,11 +251,7 @@@ AC_CHECK_HEADERS(linux/netdevice.h, [] #endif ]) -# For apache plugin -AC_CHECK_HEADERS(curl/curl.h) - # For quota module -AC_CHECK_HEADERS(pwd.h) AC_CHECK_HEADERS(sys/ucred.h, [], [], [ #if HAVE_SYS_TYPES_H @@@ -261,8 -310,21 +261,8 @@@ # include #endif ]) -AC_CHECK_HEADERS(ctype.h) -AC_CHECK_HEADERS(limits.h) -AC_CHECK_HEADERS(sys/quota.h) -AC_CHECK_HEADERS(xfs/xqm.h) # For mount interface -AC_CHECK_HEADERS(fs_info.h) -AC_CHECK_HEADERS(fshelp.h) -AC_CHECK_HEADERS(paths.h) -AC_CHECK_HEADERS(mntent.h) -AC_CHECK_HEADERS(mnttab.h) -AC_CHECK_HEADERS(sys/fstyp.h) -AC_CHECK_HEADERS(sys/fs_types.h) -AC_CHECK_HEADERS(sys/mntent.h) -AC_CHECK_HEADERS(sys/mnttab.h) AC_CHECK_HEADERS(sys/mount.h, [], [], [ #if HAVE_SYS_TYPES_H @@@ -272,6 -334,13 +272,6 @@@ # include #endif ]) -AC_CHECK_HEADERS(sys/statfs.h) -AC_CHECK_HEADERS(sys/statvfs.h) -AC_CHECK_HEADERS(sys/vfs.h) -AC_CHECK_HEADERS(sys/vfstab.h) - -# For the swap plugin, FreeBSD -AC_CHECK_HEADERS(kvm.h) # For the email plugin AC_CHECK_HEADERS(linux/un.h, [], [], @@@ -280,8 -349,14 +280,8 @@@ # include #endif ]) -AC_CHECK_HEADERS(sys/un.h) -AC_CHECK_HEADERS(grp.h) - -# For debugging interface (variable number of arguments) -AC_CHECK_HEADERS(stdarg.h) -# Regular expressions for the ignorelist. -AC_CHECK_HEADERS(regex.h) +AC_CHECK_HEADERS(curl/curl.h pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h) # For the dns plugin AC_CHECK_HEADERS(arpa/nameser.h) @@@ -322,8 -397,8 +322,8 @@@ AC_CHECK_HEADERS(netinet/if_ether.h, [] ]) # For the multimeter plugin -AC_CHECK_HEADERS(termios.h) -AC_CHECK_HEADERS(sys/ioctl.h) +have_termios_h="no" +AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"]) # # Checking for libraries @@@ -343,7 -418,11 +343,7 @@@ AC_HEADER_TIM # Checks for library functions. # AC_PROG_GCC_TRADITIONAL -AC_CHECK_FUNCS(gettimeofday select strdup strtol) -AC_CHECK_FUNCS(getaddrinfo getnameinfo) -AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen) -AC_CHECK_FUNCS(strncasecmp strcasecmp) -AC_CHECK_FUNCS(openlog syslog closelog) +AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog) AC_CHECK_FUNCS(getpwnam_r) AC_CHECK_FUNCS(getgrnam_r) @@@ -356,22 -435,27 +356,22 @@@ nanosleep_needs_rt="no AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep))) AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes") -# Regular expressions for the ignorelist. AC_CHECK_FUNCS(regcomp regerror regexec regfree) -# For cpu module AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"]) - -# For df module -AC_CHECK_FUNCS(statfs statvfs) +AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"]) +AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"]) +AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="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(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"]) # For load module AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"]) -# For the `processes' plugin -AC_CHECK_FUNCS(thread_info) - -# For users module -AC_CHECK_FUNCS(getutent getutxent) - -# For interface module -AC_CHECK_FUNCS(getifaddrs) - # Check for NAN AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])], [ @@@ -752,70 -836,73 +752,73 @@@ AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, t ### BEGIN of check for libcurl ### with_curl_config="curl-config" - with_curl_prefix=0 + with_curl_cflags="" with_curl_libs="" AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])], [ - if test "x$withval" != "xno" -a "x$withval" != "xyes" - then - if test -x "$withval/bin/curl-config" - then - with_curl_config="$withval/bin/curl-config" - with_curl_prefix=1 - fi - fi if test "x$withval" = "xno" then with_libcurl="no" - else + else if test "x$withval" = "xyes" + then with_libcurl="yes" - fi + else + if test -x "$withval" + then + with_curl_config="$withval" + else if test -x "$withval/bin/curl-config" + then + with_curl_config="$withval/bin/curl-config" + fi; fi + fi; fi ], [ with_libcurl="yes" ]) if test "x$with_libcurl" = "xyes" then - with_curl_libs=`$with_curl_config --libs 2>/dev/null` + with_curl_cflags=`$with_curl_config --cflags 2>/dev/null` curl_config_status=$? if test $curl_config_status -ne 0 then with_libcurl="no" else - AC_CHECK_LIB(curl, curl_easy_init, - [ - BUILD_WITH_LIBCURL_LIBS="$with_curl_libs" - AC_SUBST(BUILD_WITH_LIBCURL_LIBS) - ], - [ - with_libcurl="no" - ], - [$with_curl_libs]) + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $with_curl_cflags" + + AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], []) + + CFLAGS="$SAVE_CFLAGS" fi fi - if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0 + if test "x$with_libcurl" = "xyes" then - with_curl_prefix=`$with_curl_config --libs 2>/dev/null` + with_curl_libs=`$with_curl_config --libs 2>/dev/null` curl_config_status=$? if test $curl_config_status -ne 0 then with_libcurl="no" else - if test -d "$with_curl_prefix/include" - then - CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include" - fi + AC_CHECK_LIB(curl, curl_easy_init, + [ + # We need to do this to have `HAVE_LIBCURL' defined but + # `-lcurl' NOT added to the default LDFLAGS. + AC_DEFINE(HAVE_LIBCURL, 1, + [Define to 1 if you have the curl library.]) + ], + [with_libcurl="no (symbol 'curl_easy_init' not found)"], + [$with_curl_libs]) fi fi - - with_libcurl_numeric=0 if test "x$with_libcurl" = "xyes" then - with_libcurl_numeric=1 + BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags" + BUILD_WITH_LIBCURL_LIBS="$with_curl_libs" + AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS) + AC_SUBST(BUILD_WITH_LIBCURL_LIBS) fi - AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).]) AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes") ### END of check for libcurl ### @@@ -925,40 -1012,74 +928,74 @@@ AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [Wether or not to use sensors library]) AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes") + with_mysql_config="mysql_config" + with_mysql_cflags="" + with_mysql_libs="" AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])], [ - if test "x$withval" != "xno" && test "x$withval" != "xyes" + if test "x$withval" = "xno" + then + with_libmysql="no" + else if test "x$withval" = "xyes" then - LDFLAGS="$LDFLAGS -L$withval/lib" - CPPFLAGS="$CPPFLAGS -I$withval/include" with_libmysql="yes" - fi + else + if test -x "$withval"; + then + with_mysql_config="$withval" + else if test -x "$withval/bin/mysql_config" + then + with_mysql_config="$withval/bin/mysql_config" + fi; fi + fi; fi ], [ with_libmysql="yes" ]) if test "x$with_libmysql" = "xyes" then - AC_CHECK_LIB(mysqlclient, mysql_init, - [ - AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).]) - ], [with_libmysql="no (libmysql not found)"]) + with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null` + mysql_config_status=$? + + if test $mysql_config_status -ne 0 + then + with_libmysql="no" + else + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $with_mysql_cflags" + + AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], []) + + CFLAGS="$SAVE_CFLAGS" + fi fi if test "x$with_libmysql" = "xyes" then - AC_CHECK_HEADERS(mysql/mysql.h, - [ - AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the header file.]) - ], [with_libmysql="no (mysql/mysql.h not found)"]) + with_mysql_libs=`$with_mysql_config --libs 2>/dev/null` + mysql_config_status=$? + + if test $mysql_config_status -ne 0 + then + with_libmysql="no" + else + AC_CHECK_LIB(mysqlclient, mysql_init, + [ + # We need to do this to have `HAVE_LIBMYSQLCLIENT' defined + # but `-lmysqlclient' NOT added to the default LDFLAGS. + AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, + [Define to 1 if you have the mysqlclient library.]) + ], + [with_libmysql="no (libmysql not found)"], + [$with_mysql_libs]) + fi fi if test "x$with_libmysql" = "xyes" then - collect_libmysql=1 - else - collect_libmysql=0 + BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags" + BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs" + AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS) + AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS) fi - AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql], - [Wether or not to use mysql library]) AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes") with_own_liboconfig="no" @@@ -1056,6 -1177,10 +1093,6 @@@ the fi AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes") AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes") -if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes" -then - with_liboping="yes (shipped version)" -fi AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])], [ @@@ -1189,46 -1314,14 +1226,46 @@@ els fi AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") -# TODO: Use `libupsclient-config' here. -AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])], +AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" + with_libnetsnmp="yes" + fi +], +[with_libnetsnmp="yes"]) +if test "x$with_libnetsnmp" = "xyes" +then + AC_CHECK_LIB(netsnmp, init_snmp, + [ + AC_DEFINE(HAVE_LIBSNMP, 1, [Define to 1 if you have the Net-SNMP library (-lnetsnmp).]) + ], [with_libnetsnmp="no (libnetsnmp not found)"]) +fi +if test "x$with_libnetsnmp" = "xyes" +then + AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, + [ + AC_DEFINE(HAVE_NET_SNMP_NET_SNMP_CONFIG_H, 1, [Define to 1 if you have the header file.]) + ], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]) +fi +AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes") + +with_upsclient_config="libupsclient-config" +with_upsclient_cflags="" +with_upsclient_libs="" +AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])], +[ + if test "x$withval" = "xno" + then + with_libupsclient="no" + else with_libupsclient="yes" + if "x$withval" != "xyes" + then + with_upsclient_config="$withval/bin/libupsclient-config" + fi fi ], [ @@@ -1236,115 -1329,27 +1273,122 @@@ ]) if test "x$with_libupsclient" = "xyes" then + with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null` + upsclient_config_status=$? + + if test $upsclient_config_status -ne 0 + then + with_libupsclient="no" + fi +fi +if test "x$with_libupsclient" = "xyes" +then + with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null` + upsclient_config_status=$? + + if test $upsclient_config_status -ne 0 + then + with_libupsclient="no" + fi +fi +if test "x$with_libupsclient" = "xyes" +then + CFLAGS_ORIG=$CFLAGS + CFLAGS="$CFLAGS $with_upsclient_cflags" + LDFLAGS_ORIG=$LDFLAGS + LDFLAGS="$LDFLAGS $with_upsclient_libs" AC_CHECK_LIB(upsclient, upscli_connect, [ - AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).]) - ], [with_libupsclient="no (libupsclient not found)"]) + BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags" + BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs" + AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS) + AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS) + ], + [ + with_libupsclient="no" + ]) + CFLAGS=$CFLAGS_ORIG + LDFLAGS=$LDFLAGS_ORIG fi if test "x$with_libupsclient" = "xyes" then - AC_CHECK_HEADERS(upsclient.h, - [ - AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the header file.]) - ], [with_libupsclient="no (upsclient.h not found)"]) + AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).]) fi + if test "x$with_libupsclient" = "xyes" + then + AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [], + [#include + #include + #include ]) + fi AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes") +### BEGIN of check for libxmms ### +with_xmms_config="xmms-config" +with_xmms_cflags="" +with_xmms_libs="" +AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])], +[ + if test "x$withval" != "xno" -a "x$withval" != "xyes" + then + if test -x "$withval/bin/xmms-config" + then + with_xmms_config="$withval/bin/xmms-config" + fi + fi + if test "x$withval" = "xno" + then + with_libxmms="no" + else + with_libxmms="yes" + fi +], +[ + with_libxmms="yes" +]) +if test "x$with_libxmms" = "xyes" +then + with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null` + xmms_config_status=$? + + if test $xmms_config_status -ne 0 + then + with_libxmms="no" + fi +fi +if test "x$with_libxmms" = "xyes" +then + with_xmms_libs=`$with_xmms_config --libs 2>/dev/null` + xmms_config_status=$? + + if test $xmms_config_status -ne 0 + then + with_libxmms="no" + fi +fi +if test "x$with_libxmms" = "xyes" +then + AC_CHECK_LIB(xmms, xmms_remote_get_info, + [ + BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags" + BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs" + AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS) + AC_SUBST(BUILD_WITH_LIBXMMS_LIBS) + ], + [ + with_libxmms="no" + ], + [$with_xmms_libs]) +fi +with_libxmms_numeric=0 +if test "x$with_libxmms" = "xyes" +then + with_libxmms_numeric=1 +fi +AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).]) +AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes") +### END of check for libxmms ### + # Check for enabled/disabled features # @@@ -1408,227 -1413,56 +1452,227 @@@ f ]dnl )# AC_COLLECTD(name, enable/disable, info-text, feature/module) +# AC_PLUGIN(name, default, info) +# ------------------------------------------------------------ +dnl +AC_DEFUN( + [AC_PLUGIN], + [ + enable_plugin="no" + AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]), + [ + if test "x$enableval" = "xyes" + then + enable_plugin="yes" + else + enable_plugin="no" + fi + ], + [ + if test "x$2" = "xyes" + then + enable_plugin="yes" + else + enable_plugin="no" + fi + ]) + if test "x$enable_plugin" = "xyes" + then + AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.]) + fi + AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes") + enable_$1="$enable_plugin" + ] +)# AC_PLUGIN(name, default, info) + m4_divert_once([HELP_ENABLE], [ collectd features:]) +# FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro. AC_COLLECTD([debug], [enable], [feature], [debugging]) AC_COLLECTD([daemon], [disable], [feature], [daemon mode]) AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux]) +plugin_battery="no" +plugin_cpu="no" +plugin_cpufreq="no" +plugin_df="no" +plugin_disk="no" +plugin_entropy="no" +plugin_interface="no" +plugin_irq="no" +plugin_load="no" +plugin_memory="no" +plugin_multimeter="no" +plugin_nfs="no" +plugin_processes="no" +plugin_serial="no" +plugin_swap="no" +plugin_tape="no" +plugin_users="no" +plugin_vserver="no" +plugin_wireless="no" + +# Linux +if test "x$ac_system" = "xLinux" +then + plugin_battery="yes" + plugin_cpu="yes" + plugin_cpufreq="yes" + plugin_disk="yes" + plugin_entropy="yes" + plugin_interface="yes" + plugin_irq="yes" + plugin_load="yes" + plugin_memory="yes" + plugin_nfs="yes" + plugin_processes="yes" + plugin_serial="yes" + plugin_swap="yes" + plugin_vserver="yes" + plugin_wireless="yes" +fi + +# Mac OS X devices +if test "x$with_libiokit" = "xyes" +then + plugin_battery="yes" + plugin_disk="yes" +fi + +# Solaris +if test "x$with_devinfo$with_kstat" = "xyesyes" +then + plugin_cpu="yes" + plugin_disk="yes" + plugin_interface="yes" + plugin_memory="yes" + plugin_swap="yes" + plugin_tape="yes" +fi + +# libstatgrab +if test "x$with_libstatgrab" = "xyes" +then + plugin_interface="yes" + plugin_load="yes" + plugin_memory="yes" + plugin_swap="yes" +fi + +if test "x$have_processor_info" = "xyes" +then + plugin_cpu="yes" +fi +if test "x$have_sysctlbyname" = "xyes" +then + plugin_cpu="yes" + plugin_memory="yes" +fi + +if test "x$have_statfs" = "xyes" +then + plugin_df="yes" +fi +if test "x$have_statvfs" = "xyes" +then + plugin_df="yes" +fi + +if test "x$have_getifaddrs" = "xyes" +then + plugin_interface="yes" +fi + +if test "x$have_getloadavg" = "xyes" +then + plugin_load="yes" +fi + +# Mac OS X memory interface +if test "x$have_host_statistics" = "xyes" +then + plugin_memory="yes" +fi + +if test "x$have_termios_h" = "xyes" +then + plugin_multimeter="yes" +fi + +if test "x$have_thread_info" = "xyes" +then + plugin_processes="yes" +fi + +if test "x$with_libkvm" = "xyes" +then + plugin_swap="yes" +fi + +if test "x$have_getutent" = "xyes" +then + plugin_users="yes" +fi +if test "x$have_getutxent" = "xyes" +then + plugin_users="yes" +fi + +# FIXME: sysctl for swap plugin + m4_divert_once([HELP_ENABLE], [ -collectd modules:]) -AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics]) -AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC]) -AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors]) -AC_COLLECTD([battery], [disable], [module], [battery statistics]) -AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics]) -AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics]) -AC_COLLECTD([disk], [disable], [module], [disk/partition statistics]) -AC_COLLECTD([csv], [disable], [module], [csv output plugin]) -AC_COLLECTD([df], [disable], [module], [df statistics]) -AC_COLLECTD([dns], [disable], [module], [dns statistics]) -AC_COLLECTD([email], [disable], [module], [email statistics]) -AC_COLLECTD([entropy], [disable], [module], [entropy statistics]) -AC_COLLECTD([exec], [disable], [module], [exec of external programs]) -AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics]) -AC_COLLECTD([interface], [disable], [module], [interface statistics]) -AC_COLLECTD([iptables], [disable], [module], [IPtables statistics]) -AC_COLLECTD([irq], [disable], [module], [irq statistics]) -AC_COLLECTD([load], [disable], [module], [system load statistics]) -AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics]) -AC_COLLECTD([memory], [disable], [module], [memory statistics]) -AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics]) -AC_COLLECTD([mysql], [disable], [module], [mysql statistics]) -AC_COLLECTD([network], [disable], [module], [network functionality]) -AC_COLLECTD([nfs], [disable], [module], [nfs statistics]) -AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics]) -AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics]) -AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter]) -AC_COLLECTD([ping], [disable], [module], [ping statistics]) -AC_COLLECTD([processes], [disable], [module], [processes statistics]) -AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics]) -AC_COLLECTD([serial], [disable], [module], [serial statistics]) -AC_COLLECTD([logfile], [disable], [module], [logfile log facility]) -AC_COLLECTD([swap], [disable], [module], [swap statistics]) -AC_COLLECTD([syslog], [disable], [module], [syslog log facility]) -AC_COLLECTD([tape], [disable], [module], [tape statistics]) -AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin]) -AC_COLLECTD([users], [disable], [module], [user count statistics]) -AC_COLLECTD([vserver], [disable], [module], [vserver statistics]) -AC_COLLECTD([wireless], [disable], [module], [wireless link statistics]) +collectd plugins:]) + +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([battery], [$plugin_battery], [Battery statistics]) +AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics]) +AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics]) +AC_PLUGIN([csv], [yes], [CSV output plugin]) +AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics]) +AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics]) +AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis]) +AC_PLUGIN([email], [yes], [EMail statistics]) +AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics]) +AC_PLUGIN([exec], [yes], [Execution of external programs]) +AC_PLUGIN([hddtemp], [yes], [Query hddtempd]) +AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics]) +AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) +AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) +AC_PLUGIN([load], [$plugin_load], [System load]) +AC_PLUGIN([logfile], [yes], [File logging plugin]) +AC_PLUGIN([mbmon], [yes], [Query mbmond]) +AC_PLUGIN([memory], [$plugin_memory], [Memory usage]) +AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values]) +AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics]) +AC_PLUGIN([network], [yes], [Network communication plugin]) +AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics]) +AC_PLUGIN([ntpd], [yes], [NTPd statistics]) +AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics]) +AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter]) +AC_PLUGIN([ping], [$with_liboping], [Network latency statistics]) +AC_PLUGIN([processes], [$plugin_processes], [Process statistics]) +AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin]) +AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics]) +AC_PLUGIN([serial], [$plugin_serial], [serial port traffic]) +AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin]) +AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics]) +AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin]) +AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics]) +AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin]) +AC_PLUGIN([users], [$plugin_users], [User statistics]) +AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics]) +AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics]) +AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics]) AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile) +if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes" +then + with_liboping="yes (shipped version)" +fi + if test "x$with_libperl" = "xyes" then with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)" @@@ -1644,9 -1478,7 +1688,9 @@@ Configuration libiokit . . . . . $with_libiokit libiptc . . . . . . $with_libiptc libkstat . . . . . $with_kstat + libkvm . . . . . . $with_libkvm libmysql . . . . . $with_libmysql + libnetsnmp . . . . $with_libnetsnmp liboconfig . . . . $with_liboconfig liboping . . . . . $with_liboping libpcap . . . . . . $with_libpcap @@@ -1656,7 -1488,6 +1700,7 @@@ libsensors . . . . $with_lm_sensors libstatgrab . . . . $with_libstatgrab libupsclient . . . $with_libupsclient + libxmms . . . . . . $with_libxmms Features: daemon mode . . . . $enable_daemon @@@ -1695,7 -1526,6 +1739,7 @@@ processes . . . . . $enable_processes sensors . . . . . . $enable_sensors serial . . . . . . $enable_serial + snmp . . . . . . . $enable_snmp swap . . . . . . . $enable_swap syslog . . . . . . $enable_syslog tape . . . . . . . $enable_tape @@@ -1703,6 -1533,5 +1747,6 @@@ users . . . . . . . $enable_users vserver . . . . . . $enable_vserver wireless . . . . . $enable_wireless + xmms . . . . . . . $enable_xmms EOF diff --combined contrib/README index cb6df018,467ecb32..685903b3 --- a/contrib/README +++ b/contrib/README @@@ -1,5 -1,5 +1,5 @@@ The files in this directory may be used to perform common tasks that aren't - exactly `collectd's job. They may or may not require in-depth knowlege of RRD + exactly `collectd's job. They may or may not require in-depth knowledge of RRD files and/or `collectd's inner workings. Use at your own risk. PerlLib/ @@@ -10,9 -10,9 +10,9 @@@ documentation of the .pm-files to find add_rra.sh ---------- Before version 3.9.0 collectd used to create a different set of RRAs. The - most detailed of these old RRAs hat a one minute resolution. This script can + most detailed of these old RRAs had a one minute resolution. This script can be used to add three more RRAs: minimum, maximum and average with a ten second - resolution and 2200 rows (~6 hours). This will make houly statistics much more + resolution and 2200 rows (~6 hours). This will make hourly statistics much more interesting. Please note that no sanity- checking whatsoever is performed. You can seriously fuck up your RRD files if you don't know what you're doing. @@@ -24,19 -24,8 +24,19 @@@ several PNG files which are graphs of t collection.cgi -------------- - Sample CGI script that creates graphs on the fly. The Perl module `RRDs' is -needed (Debian package `librrds-perl'). + Sample CGI script that creates graphs on the fly. The Perl modules `RRDs' +(Debian package `librrds-perl'), `URI:Escape' (package liburi-perl), +`HTML::Entities' (package libhtml-parser-perl) and a CGI capable web server +(e.g. apache2 or boa) are needed. Simply install the script to a place where +the webserver will treat it as a CGI script (/usr/lib/cgi-bin/ by default) and +visit that page in a browser (http://localhost/cgi-bin/collection.cgi by +default). Please refer to your webserver's documentation for more details. + + Starting with version 4, collection.cgi requires a small config file, which +should look something like this: + + datadir: "/var/lib/collectd/rrd/" + libdir: "/usr/lib/collectd/" extractDS.px ------------ diff --combined src/Makefile.am index 234ad6d3,ab4d46a6..6f3db918 --- a/src/Makefile.am +++ b/src/Makefile.am @@@ -25,7 -25,6 +25,7 @@@ collectd_SOURCES = collectd.c collectd. collectd_CPPFLAGS = $(LTDLINCL) collectd_CPPFLAGS += -DPREFIX='"${prefix}"' collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' +collectd_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"' collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"' if BUILD_FEATURE_DAEMON collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"' @@@ -81,15 -80,21 +81,21 @@@ endi pkglib_LTLIBRARIES = -if BUILD_MODULE_APACHE +if BUILD_PLUGIN_APACHE pkglib_LTLIBRARIES += apache.la apache_la_SOURCES = apache.c - apache_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBCURL_LIBS) + apache_la_LDFLAGS = -module -avoid-version + apache_la_CFLAGS = + apache_la_LIBADD = collectd_LDADD += "-dlopen" apache.la + if BUILD_WITH_LIBCURL + apache_la_CFLAGS += $(BUILD_WITH_LIBCURL_CFLAGS) + apache_la_LIBADD += $(BUILD_WITH_LIBCURL_LIBS) + endif collectd_DEPENDENCIES += apache.la endif -if BUILD_MODULE_APCUPS +if BUILD_PLUGIN_APCUPS pkglib_LTLIBRARIES += apcups.la apcups_la_SOURCES = apcups.c apcups_la_LDFLAGS = -module -avoid-version @@@ -100,15 -105,18 +106,15 @@@ collectd_LDADD += "-dlopen" apcups.l collectd_DEPENDENCIES += apcups.la endif -if BUILD_MODULE_APPLE_SENSORS +if BUILD_PLUGIN_APPLE_SENSORS pkglib_LTLIBRARIES += apple_sensors.la apple_sensors_la_SOURCES = apple_sensors.c -apple_sensors_la_LDFLAGS = -module -avoid-version -if BUILD_WITH_LIBIOKIT -apple_sensors_la_LDFLAGS += -lIOKit -endif +apple_sensors_la_LDFLAGS = -module -avoid-version -lIOKit collectd_LDADD += "-dlopen" apple_sensors.la collectd_DEPENDENCIES += apple_sensors.la endif -if BUILD_MODULE_BATTERY +if BUILD_PLUGIN_BATTERY pkglib_LTLIBRARIES += battery.la battery_la_SOURCES = battery.c battery_la_LDFLAGS = -module -avoid-version @@@ -119,7 -127,7 +125,7 @@@ collectd_LDADD += "-dlopen" battery.l collectd_DEPENDENCIES += battery.la endif -if BUILD_MODULE_CPU +if BUILD_PLUGIN_CPU pkglib_LTLIBRARIES += cpu.la cpu_la_SOURCES = cpu.c cpu_la_LDFLAGS = -module -avoid-version @@@ -133,7 -141,7 +139,7 @@@ collectd_LDADD += "-dlopen" cpu.l collectd_DEPENDENCIES += cpu.la endif -if BUILD_MODULE_CPUFREQ +if BUILD_PLUGIN_CPUFREQ pkglib_LTLIBRARIES += cpufreq.la cpufreq_la_SOURCES = cpufreq.c cpufreq_la_LDFLAGS = -module -avoid-version @@@ -141,7 -149,7 +147,7 @@@ collectd_LDADD += "-dlopen" cpufreq.l collectd_DEPENDENCIES += cpufreq.la endif -if BUILD_MODULE_CSV +if BUILD_PLUGIN_CSV pkglib_LTLIBRARIES += csv.la csv_la_SOURCES = csv.c csv_la_LDFLAGS = -module -avoid-version @@@ -149,7 -157,7 +155,7 @@@ collectd_LDADD += "-dlopen" csv.l collectd_DEPENDENCIES += csv.la endif -if BUILD_MODULE_DF +if BUILD_PLUGIN_DF pkglib_LTLIBRARIES += df.la df_la_SOURCES = df.c df_la_LDFLAGS = -module -avoid-version @@@ -157,7 -165,7 +163,7 @@@ collectd_LDADD += "-dlopen" df.l collectd_DEPENDENCIES += df.la endif -if BUILD_MODULE_DISK +if BUILD_PLUGIN_DISK pkglib_LTLIBRARIES += disk.la disk_la_SOURCES = disk.c disk_la_LDFLAGS = -module -avoid-version @@@ -174,15 -182,26 +180,15 @@@ collectd_LDADD += "-dlopen" disk.l collectd_DEPENDENCIES += disk.la endif -if BUILD_MODULE_DNS +if BUILD_PLUGIN_DNS pkglib_LTLIBRARIES += dns.la -dns_la_SOURCES = dns.c -if BUILD_WITH_LIBPCAP -if BUILD_WITH_LIBPTHREAD -dns_la_SOURCES += utils_dns.c utils_dns.h -endif -endif -dns_la_LDFLAGS = -module -avoid-version -if BUILD_WITH_LIBPCAP -dns_la_LDFLAGS += -lpcap -endif -if BUILD_WITH_LIBPTHREAD -dns_la_LDFLAGS += -lpthread -endif +dns_la_SOURCES = dns.c utils_dns.c utils_dns.h +dns_la_LDFLAGS = -module -avoid-version -lpcap -lpthread collectd_LDADD += "-dlopen" dns.la collectd_DEPENDENCIES += dns.la endif -if BUILD_MODULE_EMAIL +if BUILD_PLUGIN_EMAIL pkglib_LTLIBRARIES += email.la email_la_SOURCES = email.c email_la_LDFLAGS = -module -avoid-version @@@ -193,7 -212,7 +199,7 @@@ collectd_LDADD += "-dlopen" email.l collectd_DEPENDENCIES += email.la endif -if BUILD_MODULE_ENTROPY +if BUILD_PLUGIN_ENTROPY pkglib_LTLIBRARIES += entropy.la entropy_la_SOURCES = entropy.c entropy_la_LDFLAGS = -module -avoid-version @@@ -201,7 -220,7 +207,7 @@@ collectd_LDADD += "-dlopen" entropy.l collectd_DEPENDENCIES += entropy.la endif -if BUILD_MODULE_EXEC +if BUILD_PLUGIN_EXEC pkglib_LTLIBRARIES += exec.la exec_la_SOURCES = exec.c exec_la_LDFLAGS = -module -avoid-version @@@ -212,7 -231,7 +218,7 @@@ collectd_LDADD += "-dlopen" exec.l collectd_DEPENDENCIES += exec.la endif -if BUILD_MODULE_HDDTEMP +if BUILD_PLUGIN_HDDTEMP pkglib_LTLIBRARIES += hddtemp.la hddtemp_la_SOURCES = hddtemp.c hddtemp_la_LDFLAGS = -module -avoid-version @@@ -223,7 -242,7 +229,7 @@@ collectd_LDADD += "-dlopen" hddtemp.l collectd_DEPENDENCIES += hddtemp.la endif -if BUILD_MODULE_INTERFACE +if BUILD_PLUGIN_INTERFACE pkglib_LTLIBRARIES += interface.la interface_la_SOURCES = interface.c interface_la_LDFLAGS = -module -avoid-version @@@ -246,15 -265,18 +252,15 @@@ interface_la_LDFLAGS += -lstatgra endif endif -if BUILD_MODULE_IPTABLES +if BUILD_PLUGIN_IPTABLES pkglib_LTLIBRARIES += iptables.la iptables_la_SOURCES = iptables.c -iptables_la_LDFLAGS = -module -avoid-version -if BUILD_WITH_LIBIPTC -iptables_la_LDFLAGS += -liptc -endif +iptables_la_LDFLAGS = -module -avoid-version -liptc collectd_LDADD += "-dlopen" iptables.la collectd_DEPENDENCIES += iptables.la endif -if BUILD_MODULE_IRQ +if BUILD_PLUGIN_IRQ pkglib_LTLIBRARIES += irq.la irq_la_SOURCES = irq.c irq_la_LDFLAGS = -module -avoid-version @@@ -262,7 -284,7 +268,7 @@@ collectd_LDADD += "-dlopen" irq.l collectd_DEPENDENCIES += irq.la endif -if BUILD_MODULE_LOAD +if BUILD_PLUGIN_LOAD pkglib_LTLIBRARIES += load.la load_la_SOURCES = load.c load_la_LDFLAGS = -module -avoid-version @@@ -279,7 -301,7 +285,7 @@@ load_la_LDFLAGS += -lstatgra endif endif -if BUILD_MODULE_LOGFILE +if BUILD_PLUGIN_LOGFILE pkglib_LTLIBRARIES += logfile.la logfile_la_SOURCES = logfile.c logfile_la_LDFLAGS = -module -avoid-version @@@ -287,7 -309,7 +293,7 @@@ collectd_LDADD += "-dlopen" logfile.l collectd_DEPENDENCIES += logfile.la endif -if BUILD_MODULE_MBMON +if BUILD_PLUGIN_MBMON pkglib_LTLIBRARIES += mbmon.la mbmon_la_SOURCES = mbmon.c mbmon_la_LDFLAGS = -module -avoid-version @@@ -298,7 -320,7 +304,7 @@@ collectd_LDADD += "-dlopen" mbmon.l collectd_DEPENDENCIES += mbmon.la endif -if BUILD_MODULE_MEMORY +if BUILD_PLUGIN_MEMORY pkglib_LTLIBRARIES += memory.la memory_la_SOURCES = memory.c memory_la_LDFLAGS = -module -avoid-version @@@ -321,7 -343,7 +327,7 @@@ memory_la_LDFLAGS += -lstatgra endif endif -if BUILD_MODULE_MULTIMETER +if BUILD_PLUGIN_MULTIMETER pkglib_LTLIBRARIES += multimeter.la multimeter_la_SOURCES = multimeter.c multimeter_la_LDFLAGS = -module -avoid-version @@@ -329,15 -351,21 +335,21 @@@ collectd_LDADD += "-dlopen" multimeter. collectd_DEPENDENCIES += multimeter.la endif -if BUILD_MODULE_MYSQL +if BUILD_PLUGIN_MYSQL pkglib_LTLIBRARIES += mysql.la mysql_la_SOURCES = mysql.c - mysql_la_LDFLAGS = -module -avoid-version -lmysqlclient + mysql_la_LDFLAGS = -module -avoid-version + mysql_la_CFLAGS = + mysql_la_LIBADD = collectd_LDADD += "-dlopen" mysql.la + if BUILD_WITH_LIBMYSQL + mysql_la_CFLAGS += $(BUILD_WITH_LIBMYSQL_CFLAGS) + mysql_la_LIBADD += $(BUILD_WITH_LIBMYSQL_LIBS) + endif collectd_DEPENDENCIES += mysql.la endif -if BUILD_MODULE_NETWORK +if BUILD_PLUGIN_NETWORK pkglib_LTLIBRARIES += network.la network_la_SOURCES = network.c network.h network_la_LDFLAGS = -module -avoid-version @@@ -351,7 -379,7 +363,7 @@@ collectd_LDADD += "-dlopen" network.l collectd_DEPENDENCIES += network.la endif -if BUILD_MODULE_NFS +if BUILD_PLUGIN_NFS pkglib_LTLIBRARIES += nfs.la nfs_la_SOURCES = nfs.c nfs_la_LDFLAGS = -module -avoid-version @@@ -359,7 -387,7 +371,7 @@@ collectd_LDADD += "-dlopen" nfs.l collectd_DEPENDENCIES += nfs.la endif -if BUILD_MODULE_NTPD +if BUILD_PLUGIN_NTPD pkglib_LTLIBRARIES += ntpd.la ntpd_la_SOURCES = ntpd.c ntpd_la_LDFLAGS = -module -avoid-version @@@ -370,16 -398,22 +382,16 @@@ collectd_LDADD += "-dlopen" ntpd.l collectd_DEPENDENCIES += ntpd.la endif -if BUILD_MODULE_NUT +if BUILD_PLUGIN_NUT pkglib_LTLIBRARIES += nut.la nut_la_SOURCES = nut.c -nut_la_LDFLAGS = -module -avoid-version -if BUILD_WITH_LIBUPSCLIENT -nut_la_LDFLAGS += -lupsclient -if BUILD_WITH_LIBPTHREAD -nut_la_LDFLAGS += -lpthread -endif -endif +nut_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBUPSCLIENT_CFLAGS) +nut_la_LDFLAGS = -module -avoid-version -lpthread $(BUILD_WITH_LIBUPSCLIENT_LIBS) collectd_LDADD += "-dlopen" nut.la collectd_DEPENDENCIES += nut.la endif -if BUILD_WITH_LIBPERL -if BUILD_MODULE_PERL +if BUILD_PLUGIN_PERL pkglib_LTLIBRARIES += perl.la perl_la_SOURCES = perl.c perl_la_CFLAGS = $(AM_CFLAGS) \ @@@ -390,22 -424,25 +402,22 @@@ perl_la_LDFLAGS = -module -avoid-versio collectd_LDADD += "-dlopen" perl.la collectd_DEPENDENCIES += perl.la endif -endif -if BUILD_MODULE_PING +if BUILD_PLUGIN_PING pkglib_LTLIBRARIES += ping.la ping_la_SOURCES = ping.c ping_la_LDFLAGS = -module -avoid-version -if BUILD_WITH_LIBOPING if BUILD_WITH_OWN_LIBOPING ping_la_LIBADD = liboping/liboping.la ping_la_DEPENDENCIES = liboping/liboping.la else ping_la_LDFLAGS += -loping endif -endif collectd_LDADD += "-dlopen" ping.la collectd_DEPENDENCIES += ping.la endif -if BUILD_MODULE_PROCESSES +if BUILD_PLUGIN_PROCESSES pkglib_LTLIBRARIES += processes.la processes_la_SOURCES = processes.c processes_la_LDFLAGS = -module -avoid-version @@@ -413,7 -450,7 +425,7 @@@ collectd_LDADD += "-dlopen" processes.l collectd_DEPENDENCIES += processes.la endif -if BUILD_WITH_RRDTOOL +if BUILD_PLUGIN_RRDTOOL pkglib_LTLIBRARIES += rrdtool.la rrdtool_la_SOURCES = rrdtool.c rrdtool_la_LDFLAGS = -module -avoid-version -lrrd @@@ -421,7 -458,7 +433,7 @@@ collectd_LDADD += "-dlopen" rrdtool.l collectd_DEPENDENCIES += rrdtool.la endif -if BUILD_MODULE_SENSORS +if BUILD_PLUGIN_SENSORS pkglib_LTLIBRARIES += sensors.la sensors_la_SOURCES = sensors.c sensors_la_LDFLAGS = -module -avoid-version @@@ -432,7 -469,7 +444,7 @@@ collectd_LDADD += "-dlopen" sensors.l collectd_DEPENDENCIES += sensors.la endif -if BUILD_MODULE_SERIAL +if BUILD_PLUGIN_SERIAL pkglib_LTLIBRARIES += serial.la serial_la_SOURCES = serial.c serial_la_LDFLAGS = -module -avoid-version @@@ -440,21 -477,7 +452,21 @@@ collectd_LDADD += "-dlopen" serial.l collectd_DEPENDENCIES += serial.la endif -if BUILD_MODULE_SWAP +if BUILD_PLUGIN_SNMP +pkglib_LTLIBRARIES += snmp.la +snmp_la_SOURCES = snmp.c +snmp_la_LDFLAGS = -module -avoid-version +if BUILD_WITH_LIBNETSNMP +snmp_la_LDFLAGS += -lnetsnmp +endif +if BUILD_WITH_LIBPTHREAD +snmp_la_LDFLAGS += -lpthread +endif +collectd_LDADD += "-dlopen" snmp.la +collectd_DEPENDENCIES += snmp.la +endif + +if BUILD_PLUGIN_SWAP pkglib_LTLIBRARIES += swap.la swap_la_SOURCES = swap.c swap_la_LDFLAGS = -module -avoid-version @@@ -477,7 -500,7 +489,7 @@@ swap_la_LDFLAGS += -lstatgra endif endif -if BUILD_MODULE_SYSLOG +if BUILD_PLUGIN_SYSLOG pkglib_LTLIBRARIES += syslog.la syslog_la_SOURCES = syslog.c syslog_la_LDFLAGS = -module -avoid-version @@@ -485,24 -508,30 +497,24 @@@ collectd_LDADD += "-dlopen" syslog.l collectd_DEPENDENCIES += syslog.la endif -if BUILD_MODULE_TAPE +if BUILD_PLUGIN_TAPE pkglib_LTLIBRARIES += tape.la tape_la_SOURCES = tape.c -tape_la_LDFLAGS = -module -avoid-version -if BUILD_WITH_LIBKSTAT -tape_la_LDFLAGS += -lkstat -endif -if BUILD_WITH_LIBDEVINFO -tape_la_LDFLAGS += -ldevinfo -endif +tape_la_LDFLAGS = -module -avoid-version -lkstat -ldevinfo collectd_LDADD += "-dlopen" tape.la collectd_DEPENDENCIES += tape.la endif -if BUILD_MODULE_UNIXSOCK +if BUILD_PLUGIN_UNIXSOCK pkglib_LTLIBRARIES += unixsock.la -unixsock_la_SOURCES = unixsock.c -unixsock_la_CPPFLAGS = -DPREFIX='"${prefix}"' +unixsock_la_SOURCES = unixsock.c utils_cmd_putval.h utils_cmd_putval.c +unixsock_la_CPPFLAGS = -DLOCALSTATEDIR='"${localstatedir}"' unixsock_la_LDFLAGS = -module -avoid-version -lpthread collectd_LDADD += "-dlopen" unixsock.la collectd_DEPENDENCIES += unixsock.la endif -if BUILD_MODULE_USERS +if BUILD_PLUGIN_USERS pkglib_LTLIBRARIES += users.la users_la_SOURCES = users.c users_la_LDFLAGS = -module -avoid-version @@@ -510,7 -539,7 +522,7 @@@ collectd_LDADD += "-dlopen" users.l collectd_DEPENDENCIES += users.la endif -if BUILD_MODULE_VSERVER +if BUILD_PLUGIN_VSERVER pkglib_LTLIBRARIES += vserver.la vserver_la_SOURCES = vserver.c vserver_la_LDFLAGS = -module -avoid-version @@@ -518,7 -547,7 +530,7 @@@ collectd_LDADD += "-dlopen" vserver.l collectd_DEPENDENCIES += vserver.la endif -if BUILD_MODULE_WIRELESS +if BUILD_PLUGIN_WIRELESS pkglib_LTLIBRARIES += wireless.la wireless_la_SOURCES = wireless.c wireless_la_LDFLAGS = -module -avoid-version @@@ -526,19 -555,9 +538,19 @@@ collectd_LDADD += "-dlopen" wireless.l collectd_DEPENDENCIES += wireless.la endif +if BUILD_PLUGIN_XMMS +pkglib_LTLIBRARIES += xmms.la +xmms_la_SOURCES = xmms.c +xmms_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBXMMS_CFLAGS) +xmms_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBXMMS_LIBS) +collectd_LDADD += "-dlopen" xmms.la +collectd_DEPENDENCIES += xmms.la +endif + + dist_man_MANS = collectd.1 collectd-nagios.1 collectd.conf.5 \ collectd-email.5 collectd-exec.5 collectd-perl.5 \ - collectd-unixsock.5 + collectd-snmp.5 collectd-unixsock.5 #collectd_1_SOURCES = collectd.pod diff --combined src/collectd-unixsock.pod index b787646c,9a142f2d..1be0654d --- a/src/collectd-unixsock.pod +++ b/src/collectd-unixsock.pod @@@ -36,12 -36,12 +36,12 @@@ The following commands are implemented =item B I If the value identified by I (see below) is found the complete - value-list is returned. The response is a space seperated list of + value-list is returned. The response is a space separated list of name-value-pairs: I IB<=>I[ IB<=>I[ ...]] - If I is less then zero, an error occured. Otherwise it contains the + If I is less then zero, an error occurred. Otherwise it contains the number of values that follow. Each value is of the form IB<=>I. Counter-values are converted to a rate, e.Eg. bytes per second. Undefined values are returned as B. @@@ -50,73 -50,25 +50,73 @@@ Example -> | GETVAL myhost/cpu-0/cpu-user <- | 1 value=1.260000e+00 -=item B I I +=item B -Submits a value (identified by I, see below) to the daemon which -will dispatch it to all it's write-plugins. The I is a -colon-separated list of the time and the values, each either an integer if the -data-source is a counter, of a double if the data-source if of type "gauge". -You can submit an undefined gauge-value by using B. When submitting B to -a counter the behavior is undefined. The time is given as epoch (i.Ee. -standard UNIX time). +Returnes a list of the values available in the value cache together with the +time of the last update, so that querying applications can issue a B +command for the values that have changed. + +The first line's status number is the number of identifiers returned or less +than zero if an error occured. Each of the following lines containes the +update time as an epoch value and the identifier, seperated by a space. + +Example: + -> | LISTVAL + <- | 69 Values found + <- | 1182204284 leeloo/cpu-0/cpu-idle + <- | 1182204284 leeloo/cpu-0/cpu-nice + <- | 1182204284 leeloo/cpu-0/cpu-system + <- | 1182204284 leeloo/cpu-0/cpu-user + ... + +=item B I [I] I + +Submits one or more values (identified by I, see below) to the +daemon which will dispatch it to all it's write-plugins. + +An I is of the form +CBIB<->IBIB<->I> with both +I-parts being optional. If they're omitted the hyphen must be +omitted, too. + +The I is an optional list of I, where each option if a +key-value-pair. A list of currently understood options can be found below, all +other options will be ignored. + +I is a colon-seperated list of the time and the values, each either +an integer if the data-source is a counter, of a double if the data-source if +of type "gauge". You can submit an undefined gauge-value by using B. When +submitting B to a counter the behavior is undefined. The time is given as +epoch (i.Ee. standard UNIX time). + +You can mix options and values, but the order is important: Options only +effect following values, so specifying an option as last field is allowed, but +useless. Also, an option applies to B following values, so you don't need +to re-set an option over and over again. + +The currently defined B are: + +=over 4 + +=item BI + +Gives the interval in which the data identified by I is being +collected. + +=back + +Please note that this is the same format as used in the B, see +L. Example: - -> | PUTVAL testhost/interface/if_octets-test0 1179574444:123:456 + -> | PUTVAL testhost/interface/if_octets-test0 interval=10 1179574444:123:456 <- | 0 Success =back =head2 Identifiers - Value or value-lists are identified in a uniform fassion: + Value or value-lists are identified in a uniform fashion: I/I/I diff --combined src/collectd.conf.pod index d6de96ee,cd3fc40b..3d2237ed --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@@ -25,10 -25,10 +25,10 @@@ controls which plugins to load. These p behavior. The syntax of this config file is similar to the config file of the famos - B. Each line containes either a key-value-pair or a + B. Each line contains either a key-value-pair or a section-start or -end. Empty lines and everything after the hash-symbol `#' is ignored. Values are either string, enclosed in double-quotes, - (floating-point-)numbers or a boolean extression, i.Ee. either B or + (floating-point-)numbers or a boolean expression, i.Ee. either B or B. String containing of only alphanumeric characters and underscores do not need to be quoted. @@@ -78,7 -78,7 +78,7 @@@ a value higher than the number of plugi =head1 PLUGIN OPTIONS - Some Plugins may register own options. These options must be inclosed in a + Some Plugins may register own options. These options must be enclosed in a C-Section. Which options exist depends on the plugin used. Some plugins require external configuration, too. The C, for example, required C to be configured in the webserver you're going to @@@ -128,7 -128,7 +128,7 @@@ Optional password needed for authentica =item B I File that holds one or more SSL certificates. If you want to use HTTPS you will - possibly need this option. What CA certificates come bundeled with C + possibly need this option. What CA certificates come bundled with C and are checked by default depends on the distribution you use. =back @@@ -188,7 -188,7 +188,7 @@@ Select partitions based on the filesyst Invert the selection: If set to true, all partitions B the ones that match any one of the criteria are collected. By default only selected - partitions are collected if a selection is made. If no selection is conifured + partitions are collected if a selection is made. If no selection is configured at all, B partitions are selected. =back @@@ -214,10 -214,6 +214,10 @@@ Ignore packets that originate from thi =over 4 +=item B I + +Sets the socket-file which is to be created. + =item B I If running as root change the group of the UNIX-socket after it has been @@@ -241,7 -237,7 +241,7 @@@ at most B<16384> to prevent typos and d =head2 Plugin C Please make sure to read L before using this plugin. It - contains valueable information on when the executable is executed and the + contains valuable information on when the executable is executed and the output that is expected from it. =over 4 @@@ -289,7 -285,7 +289,7 @@@ a more detailed description see B-plugin will collect data from all interfaces. This may not be practical, especially for loopback- and similar interfaces. Thus, you can use the B-option to pick the - interfaces you're interested in. Sometimes, however, it's easier/prefered + interfaces you're interested in. Sometimes, however, it's easier/preferred to collect all interfaces I a few ones. This option enables you to do that: By setting B to I the effect of B is inversed: All selected interfaces are ignored and all @@@ -329,11 -325,11 +329,11 @@@ detailed description see B-plugin will collect data from all irqs. This may not be practical, especially if no interrupts happen. Thus, you - can use the B-option to pick the interupt you're interested in. - Sometimes, however, it's easier/prefered to collect all interupts I a + can use the B-option to pick the interrupt you're interested in. + Sometimes, however, it's easier/preferred to collect all interrupts I a few ones. This option enables you to do that: By setting B to - I the effect of B is inversed: All selected interupts are ignored - and all other interupts are collected. + I the effect of B is inversed: All selected interrupts are ignored + and all other interrupts are collected. =back @@@ -412,7 -408,7 +412,7 @@@ Password needed to log into the databas =item B I - Select this database. Defaults to I which is a perfecly reasonable + Select this database. Defaults to I which is a perfectly reasonable option for what this plugin does. =back @@@ -437,13 -433,13 +437,13 @@@ the argument is a multicast address th If no B statement is found the server tries join both, the default IPv6 multicast group and the default IPv4 multicast group. If no B statement is found the client will try to send data to the IPv6 multicast group first. If - that failes the client will try the IPv4 multicast group. + that fails the client will try the IPv4 multicast group. The default IPv6 multicast group is C. The default IPv4 multicast group is C<239.192.74.66>. The optional I argument sets the port to use. It can either be given - using a numeric port number or a service name. If the argument is omited the + using a numeric port number or a service name. If the argument is omitted the default port B<25826> is assumed. =item B I<1-255> @@@ -459,7 -455,7 +459,7 @@@ If set to I, write packets that w the sending sockets. This should only be activated when the B- and B-statements differ. Otherwise packets may be send multiple times to the same multicast group. While this results in more network traffic than - neccessary it's not a huge problem since the plugin has a duplicate detection, + necessary it's not a huge problem since the plugin has a duplicate detection, so the values will not loop. =item B I @@@ -553,7 -549,7 +553,7 @@@ and minor and major pagefaults You can use the settings B, B, B, and B to finetune your RRD-files. Please read L if you encounter problems using these settings. If you don't want to dive into the depths of RRDTool, you - can savely ignore these settings. + can safely ignore these settings. =over 4 @@@ -591,7 -587,7 +591,7 @@@ default is 1200 =item B I - Adds an RRA-timespan, given in seconds. Use this option mulitple times to have + Adds an RRA-timespan, given in seconds. Use this option multiple times to have more then one RRA. If this option is never used, the built-in default of (3600, 86400, 604800, 2678400, 31622400) is used. @@@ -648,7 -644,7 +648,7 @@@ voltage sensor I of the I If no configuration if given, the B-plugin will collect data from all sensors. This may not be practical, especially for uninteresting sensors. Thus, you can use the B-option to pick the sensors you're interested - in. Sometimes, however, it's easier/prefered to collect all sensors I a + in. Sometimes, however, it's easier/preferred to collect all sensors I a few ones. This option enables you to do that: By setting B to I the effect of B is inversed: All selected sensors are ignored and all other sensors are collected. diff --combined src/network.c index ad8d530e,84e77733..b0f8303f --- a/src/network.c +++ b/src/network.c @@@ -162,7 -162,7 +162,7 @@@ static int listen_loop = 0 static char send_buffer[BUFF_SIZE]; static char *send_buffer_ptr; static int send_buffer_fill; -static value_list_t send_buffer_vl = VALUE_LIST_INIT; +static value_list_t send_buffer_vl = VALUE_LIST_STATIC; static char send_buffer_type[DATA_MAX_NAME_LEN]; static pthread_mutex_t send_buffer_lock = PTHREAD_MUTEX_INITIALIZER; @@@ -557,13 -557,6 +557,13 @@@ static int parse_packet (void *buffer, if (status == 0) vl.time = (time_t) tmp; } + else if (ntohs (header->type) == TYPE_INTERVAL) + { + uint64_t tmp = 0; + status = parse_part_number (&buffer, &buffer_len, &tmp); + if (status == 0) + vl.interval = (int) tmp; + } else if (ntohs (header->type) == TYPE_HOST) { status = parse_part_string (&buffer, &buffer_len, @@@ -1104,16 -1097,6 +1104,16 @@@ static int add_to_buffer (char *buffer (unsigned int) vl->time); } + if (vl_def->interval != vl->interval) + { + if (write_part_number (&buffer, &buffer_size, TYPE_INTERVAL, + (uint64_t) vl->interval)) + return (-1); + vl_def->interval = vl->interval; + DEBUG ("network plugin: add_to_buffer: interval = %i", + (int) vl->interval); + } + if (strcmp (vl_def->plugin, vl->plugin) != 0) { if (write_part_string (&buffer, &buffer_size, TYPE_PLUGIN, @@@ -1249,7 -1232,11 +1249,11 @@@ static int network_config (const char * && (fields_num != 2)) return (1); else if (fields_num == 2) + { + if ((service = strchr (fields[1], '.')) != NULL) + *service = '\0'; service = fields[1]; + } node = fields[0]; if (strcasecmp ("Listen", key) == 0) diff --combined src/nut.c index 185d75cf,087604f1..f7f026a6 --- a/src/nut.c +++ b/src/nut.c @@@ -23,14 -23,32 +23,22 @@@ #include "common.h" #include "plugin.h" -#if HAVE_PTHREAD_H -# include -#endif - -#if HAVE_UPSCLIENT_H -# include -# define NUT_HAVE_READ 1 -#else -# define NUT_HAVE_READ 0 -#endif +#include +#include + #if HAVE_UPSCONN_T + typedef UPSCONN_t collectd_upsconn_t; + #elif HAVE_UPSCONN + typedef UPSCONN collectd_upsconn_t; + #else + # error "Unable to determine the UPS connection type." + #endif + - -#if NUT_HAVE_READ struct nut_ups_s; typedef struct nut_ups_s nut_ups_t; struct nut_ups_s { - UPSCONN *conn; + collectd_upsconn_t *conn; char *upsname; char *hostname; int port; @@@ -143,7 -161,7 +151,7 @@@ static int nut_read_one (nut_ups_t *ups /* (Re-)Connect if we have no connection */ if (ups->conn == NULL) { - ups->conn = (UPSCONN *) malloc (sizeof (UPSCONN)); + ups->conn = (collectd_upsconn_t *) malloc (sizeof (collectd_upsconn_t)); if (ups->conn == NULL) { ERROR ("nut plugin: malloc failed."); @@@ -277,12 -295,15 +285,12 @@@ static int nut_shutdown (void return (0); } /* int nut_shutdown */ -#endif /* NUT_HAVE_READ */ void module_register (void) { -#if NUT_HAVE_READ plugin_register_config ("nut", nut_config, config_keys, config_keys_num); plugin_register_read ("nut", nut_read); plugin_register_shutdown ("nut", nut_shutdown); -#endif } /* void module_register */ /* vim: set sw=2 ts=8 sts=2 tw=78 : */ diff --combined src/processes.c index 29492ac2,954cd0df..9d8bc01d --- a/src/processes.c +++ b/src/processes.c @@@ -80,20 -80,27 +80,20 @@@ # ifndef CONFIG_HZ # define CONFIG_HZ 100 # endif -#endif /* KERNEL_LINUX */ - -#define MODULE_NAME "processes" +/* #endif KERNEL_LINUX */ -#if HAVE_THREAD_INFO || KERNEL_LINUX -# define PROCESSES_HAVE_READ 1 #else -# define PROCESSES_HAVE_READ 0 +# error "No applicable input method." #endif #define BUFSIZE 256 -#if PROCESSES_HAVE_READ -#if HAVE_THREAD_INFO | KERNEL_LINUX static const char *config_keys[] = { "Process", NULL }; static int config_keys_num = 1; -#endif typedef struct procstat_entry_s { @@@ -136,7 -143,9 +136,7 @@@ typedef struct procsta struct procstat_entry_s *instances; } procstat_t; -#if HAVE_THREAD_INFO | KERNEL_LINUX static procstat_t *list_head_g = NULL; -#endif #if HAVE_THREAD_INFO static mach_port_t port_host_self; @@@ -150,6 -159,7 +150,6 @@@ static mach_msg_type_number_t pset_ static long pagesize_g; #endif /* KERNEL_LINUX */ -#if HAVE_THREAD_INFO | KERNEL_LINUX static void ps_list_register (const char *name) { procstat_t *new; @@@ -360,6 -370,7 +360,6 @@@ static int ps_config (const char *key, return (0); } -#endif /* HAVE_THREAD_INFO | KERNEL_LINUX */ static int ps_init (void) { @@@ -510,11 -521,14 +510,14 @@@ static int *ps_read_tasks (int pid closedir (dh); + if (list_len == 0) + return (NULL); + assert (list_len < list_size); assert (list[list_len] == 0); return (list); - } + } /* int *ps_read_tasks */ int ps_read_process (int pid, procstat_t *ps, char *state) { @@@ -1007,11 -1021,16 +1010,11 @@@ static int ps_read (void return (0); } /* int ps_read */ -#endif /* PROCESSES_HAVE_READ */ void module_register (void) { -#if PROCESSES_HAVE_READ -#if HAVE_THREAD_INFO | KERNEL_LINUX plugin_register_config ("processes", ps_config, config_keys, config_keys_num); -#endif plugin_register_init ("processes", ps_init); plugin_register_read ("processes", ps_read); -#endif /* PROCESSES_HAVE_READ */ } /* void module_register */