Merge branch 'v390-fix' into v391-fix
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 25 Jun 2006 08:48:42 +0000 (10:48 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sun, 25 Jun 2006 08:48:42 +0000 (10:48 +0200)
14 files changed:
ChangeLog
collectd.spec
configure.in
debian/changelog
src/Makefile.am
src/apache.c
src/collectd.c
src/common.c
src/hddtemp.c
src/liboping/Makefile.am
src/liboping/liboping.c
src/nfs.c
src/plugin.c
src/swap.c

index 64eaca4..e490767 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2006-04-02, Version 3.9.0
+2006-04-21, Version 3.9.1
+       * Build issues with Solaris and possible other architectures have been
+         resolved.
+       * Problems when building the `apache'-plugin without `libcurl' have
+         been resolved.
+       * A bug in the `ping' plugin has been fixed. Sorry folks.
+
+2006-04-15, Version 3.9.0
        * A plugin to monitor the Apache webserver has been added.
          <http://httpd.apache.org/>
        * A plugin to collect statistics about virtual servers using VServer.
index 9918b8f..4c56de7 100644 (file)
@@ -1,6 +1,6 @@
 Summary:       Statistics collection daemon for filling RRD files.
 Name:           collectd
-Version:       3.9.0
+Version:       3.9.1
 Release:       1
 Source:                http://collectd.org/files/%{name}-%{version}.tar.gz
 License:       GPL
@@ -101,6 +101,9 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0444,root,root) %{_libdir}/%{name}/sensors.so*
 
 %changelog
+* Fri Apr 21 2006 Florian octo Forster <octo@verplant.org> 3.9.1-1
+- New upstream version
+
 * Fri Apr 14 2006 Florian octo Forster <octo@verplant.org> 3.9.0-1
 - New upstream version
 - Added the `apache' package.
index 370f5b2..f9d3dc1 100644 (file)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(collectd, 3.9.0)
+AC_INIT(collectd, 3.9.1)
 AC_CONFIG_SRCDIR(src/collectd.c)
 AC_CONFIG_HEADERS(src/config.h)
 AM_INIT_AUTOMAKE(dist-bzip2)
@@ -177,6 +177,9 @@ AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
 # For load module
 AC_CHECK_HEADERS(sys/loadavg.h)
 
+# For the swap module
+AC_CHECK_HEADERS(sys/swap.h)
+
 # For users module
 AC_CHECK_HEADERS(utmp.h)
 AC_CHECK_HEADERS(utmpx.h)
@@ -260,12 +263,19 @@ AC_HEADER_TIME
 #
 AC_PROG_GCC_TRADITIONAL
 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
-AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
 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)
 
+socket_needs_socket="no"
+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")
+
+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")
+
 # For cpu module
 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
 
@@ -392,14 +402,6 @@ case $host_os in
 esac
 AC_MSG_RESULT([$ac_system])
 
-with_libsocket="yes"
-AC_CHECK_LIB(socket, socket,
-[
-       AC_DEFINE(HAVE_LIBSOCKET, 1, [Define to 1 if you have the 'socket' library (-lsocket).])
-],
-[with_libsocket="no"])
-AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$with_libsocket" = "xyes")
-
 with_libresolv="yes"
 AC_CHECK_LIB(resolv, res_search,
 [
@@ -472,16 +474,19 @@ AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
 if test "$ac_system" = "Solaris"
 then
        with_kstat="yes"
+       with_devinfo="yes"
 else
        with_kstat="no (Solaris only)"
+       with_devinfo="no (Solaris only)"
 fi
+
 if test "x$with_kstat" = "xyes"
 then
        AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
 fi
 if test "x$with_kstat" = "xyes"
 then
-       AC_CHECK_LIB(devinfo, di_init)
+       AC_CHECK_LIB(devinfo, di_init,, [with_devinfo="no (not found)"])
        AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
 fi
 if test "x$with_kstat" = "xyes"
@@ -492,7 +497,8 @@ else
 fi
 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
        [Wether or not to use kstat library (Solaris)])
-AM_CONDITIONAL(BUILD_WITH_KSTAT, test "x$with_kstat" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
 
 ### BEGIN of check for libcurl ###
 with_curl_config="curl-config"
index 1ad1f21..86fcc6c 100644 (file)
@@ -1,3 +1,9 @@
+collectd (3.9.1-1) unstable; urgency=low
+
+  * New upstream version
+
+ -- Florian Forster <octo@verplant.org>  Fri, 21 Apr 2006 17:38:08 +0200
+
 collectd (3.9.0-1) unstable; urgency=low
 
   * New upstream version
index c554abe..9cafbbf 100644 (file)
@@ -32,12 +32,21 @@ collectd_LDFLAGS = -export-dynamic
 if BUILD_WITH_RRDTOOL
 collectd_LDFLAGS += -lm -lrrd
 endif
+if BUILD_WITH_LIBRT
+collectd_LDFLAGS += -lrt
+endif
 if BUILD_WITH_LIBSOCKET
 collectd_LDFLAGS += -lsocket
 endif
 if BUILD_WITH_LIBRESOLV
 collectd_LDFLAGS += -lresolv
 endif
+if BUILD_WITH_LIBKSTAT
+collectd_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+collectd_LDFLAGS += -ldevinfo
+endif
 
 collectd_LDADD = $(LIBLTDL) libconfig/libconfig.la "-dlopen" self
 collectd_DEPENDENCIES = $(LIBLTDL) libconfig/libconfig.la
@@ -81,6 +90,12 @@ if BUILD_MODULE_CPU
 pkglib_LTLIBRARIES += cpu.la
 cpu_la_SOURCES = cpu.c
 cpu_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+cpu_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+cpu_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" cpu.la
 collectd_DEPENDENCIES += cpu.la
 endif
@@ -105,6 +120,12 @@ if BUILD_MODULE_DISK
 pkglib_LTLIBRARIES += disk.la
 disk_la_SOURCES = disk.c
 disk_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+disk_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+disk_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" disk.la
 collectd_DEPENDENCIES += disk.la
 endif
@@ -124,6 +145,9 @@ if BUILD_MODULE_HDDTEMP
 pkglib_LTLIBRARIES += hddtemp.la
 hddtemp_la_SOURCES = hddtemp.c
 hddtemp_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBSOCKET
+hddtemp_la_LDFLAGS += -lsocket
+endif
 collectd_LDADD += "-dlopen" hddtemp.la
 collectd_DEPENDENCIES += hddtemp.la
 endif
@@ -140,6 +164,12 @@ if BUILD_MODULE_MEMORY
 pkglib_LTLIBRARIES += memory.la
 memory_la_SOURCES = memory.c
 memory_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+memory_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+memory_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" memory.la
 collectd_DEPENDENCIES += memory.la
 endif
@@ -204,6 +234,12 @@ if BUILD_MODULE_SWAP
 pkglib_LTLIBRARIES += swap.la
 swap_la_SOURCES = swap.c
 swap_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+swap_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+swap_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" swap.la
 collectd_DEPENDENCIES += swap.la
 endif
@@ -212,6 +248,12 @@ if BUILD_MODULE_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
 collectd_LDADD += "-dlopen" tape.la
 collectd_DEPENDENCIES += tape.la
 endif
@@ -220,6 +262,12 @@ if BUILD_MODULE_TRAFFIC
 pkglib_LTLIBRARIES += traffic.la
 traffic_la_SOURCES = traffic.c
 traffic_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+traffic_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+traffic_la_LDFLAGS += -ldevinfo
+endif
 collectd_LDADD += "-dlopen" traffic.la
 collectd_DEPENDENCIES += traffic.la
 endif
index c410dc4..c731908 100644 (file)
@@ -38,13 +38,13 @@ static char *url  = NULL;
 static char *user = NULL;
 static char *pass = NULL;
 
-#if APACHE_HAVE_READ
+#if HAVE_LIBCURL
 static CURL *curl = NULL;
 
 static char apache_buffer[4096];
 static int  apache_buffer_len = 0;
 static char apache_curl_error[CURL_ERROR_SIZE];
-#endif
+#endif /* HAVE_LIBCURL */
 
 /* Limit to 2^27 bytes/s. That's what a gigabit-ethernet link can handle, in
  * theory. */
@@ -82,7 +82,7 @@ static char *config_keys[] =
 };
 static int config_keys_num = 3;
 
-
+#if HAVE_LIBCURL
 static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb, void *stream)
 {
        size_t len = size * nmemb;
@@ -101,6 +101,7 @@ static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb, void *
 
        return (len);
 }
+#endif /* HAVE_LIBCURL */
 
 static int config_set (char **var, char *value)
 {
@@ -130,7 +131,7 @@ static int config (char *key, char *value)
 
 static void init (void)
 {
-#if APACHE_HAVE_READ
+#if HAVE_LIBCURL
        static char credentials[1024];
 
        if (curl != NULL)
@@ -163,7 +164,7 @@ static void init (void)
        {
                curl_easy_setopt (curl, CURLOPT_URL, url);
        }
-#endif /* APACHE_HAVE_READ */
+#endif /* HAVE_LIBCURL */
 }
 
 static void bytes_write (char *host, char *inst, char *val)
index 1b44e15..b4ee504 100644 (file)
@@ -256,7 +256,7 @@ static int pidfile_create (const char *file)
                return (1);
        }
 
-       fprintf (fh, "%d\n", getpid());
+       fprintf (fh, "%i\n", (int) getpid ());
        fclose(fh);
 
        return (0);
index 58db4d8..78be3af 100644 (file)
@@ -488,7 +488,7 @@ static int log_create_file (char *filename, char **ds_def, int ds_num)
 
                /* The `%.*s' is needed because there is no null-byte behind
                 * the name. */
-               fprintf(log, ",%.*s", (tmp - name), name);
+               fprintf(log, ",%.*s", (int) (tmp - name), name);
        }
        fprintf(log, "\n");
        fclose(log);
@@ -522,7 +522,7 @@ static int log_update_file (char *host, char *file, char *values,
        strncpy (full_file, file, 1024);
 
        tmp = full_file + strlen (full_file) - 4;
-       assert (tmp > 0);
+       assert ((tmp != NULL) && (tmp > full_file));
 
        /* Change the filename for logfiles. */
        if (strncmp (tmp, ".rrd", 4) == 0)
index a89765a..cbe6e80 100644 (file)
@@ -346,7 +346,8 @@ static void hddtemp_init (void)
 
                        if ((entry = (hddname_t *) malloc (sizeof (hddname_t))) == NULL)
                        {
-                               syslog (LOG_ERR, "hddtemp: malloc (%u) == NULL", sizeof (hddname_t));
+                               syslog (LOG_ERR, "hddtemp: malloc (%u) == NULL",
+                                               (unsigned int) sizeof (hddname_t));
                                free (name);
                                continue;
                        }
index 14bd3ed..8958aed 100644 (file)
@@ -8,4 +8,7 @@ noinst_LTLIBRARIES = liboping.la
 
 #liboping_la_CFLAGS = 
 liboping_la_LDFLAGS = -avoid-version
+if BUILD_WITH_LIBSOCKET
+liboping_la_LDFLAGS += -lsocket
+endif
 liboping_la_SOURCES = liboping.h liboping.c
index 43d5fd5..7c094e9 100644 (file)
@@ -723,6 +723,10 @@ pingobj_t *ping_construct (void)
 
        obj->head = NULL;
 
+       obj->timeout    = PING_DEF_TIMEOUT;
+       obj->ttl        = PING_DEF_TTL;
+       obj->addrfamily = PING_DEF_AF;
+
        return (obj);
 }
 
index efb8dc6..d0f33c5 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -27,7 +27,8 @@
 
 #define MODULE_NAME "nfs"
 
-#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT)
+/* #if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) */
+#if KERNEL_LINUX
 # define NFS_HAVE_READ 1
 #else
 # define NFS_HAVE_READ 0
@@ -133,7 +134,7 @@ static char *nfs3_procedures_ds_def[] =
 };
 static int nfs3_procedures_ds_num = 22;
 
-#ifdef HAVE_LIBKSTAT
+#if HAVE_LIBKSTAT && 0
 extern kstat_ctl_t *kc;
 static kstat_t *nfs2_ksp_client;
 static kstat_t *nfs2_ksp_server;
@@ -147,7 +148,7 @@ static kstat_t *nfs4_ksp_server;
 
 static void nfs_init (void)
 {
-#ifdef HAVE_LIBKSTAT
+#if HAVE_LIBKSTAT && 0
        kstat_t *ksp_chain;
 
        nfs2_ksp_client = NULL;
@@ -258,7 +259,7 @@ static void nfs3_procedures_submit (unsigned long long *val, char *inst)
 }
 #endif /* NFS_HAVE_READ */
 
-#if defined(KERNEL_LINUX)
+#if KERNEL_LINUX
 static void nfs_read_stats_file (FILE *fh, char *inst)
 {
        char buffer[BUFSIZE];
@@ -329,7 +330,7 @@ static void nfs_read_stats_file (FILE *fh, char *inst)
 #endif /* defined(KERNEL_LINUX) */
 #undef BUFSIZE
 
-#ifdef HAVE_LIBKSTAT
+#if HAVE_LIBKSTAT && 0
 static void nfs2_read_kstat (kstat_t *ksp, char *inst)
 {
        unsigned long long values[18];
@@ -360,7 +361,7 @@ static void nfs2_read_kstat (kstat_t *ksp, char *inst)
 #if NFS_HAVE_READ
 static void nfs_read (void)
 {
-#if defined(KERNEL_LINUX)
+#if KERNEL_LINUX
        FILE *fh;
 
        if ((fh = fopen ("/proc/net/rpc/nfs", "r")) != NULL)
@@ -377,7 +378,7 @@ static void nfs_read (void)
 
 /* #endif defined(KERNEL_LINUX) */
 
-#elif defined(HAVE_LIBKSTAT)
+#elif HAVE_LIBKSTAT && 0
        if (nfs2_ksp_client != NULL)
                nfs2_read_kstat (nfs2_ksp_client, "client");
        if (nfs2_ksp_server != NULL)
index 570b6a2..2f52157 100644 (file)
@@ -129,7 +129,7 @@ int plugin_load_file (char *file)
                return (1);
        }
 
-       if ((reg_handle = lt_dlsym (dlh, "module_register")) == NULL)
+       if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
        {
                syslog (LOG_WARNING, "Couldn't find symbol ``module_register'' in ``%s'': %s\n",
                                file, lt_dlerror ());
index b7fc7ed..0891503 100644 (file)
@@ -32,9 +32,9 @@
 # define SWAP_HAVE_READ 0
 #endif
 
-#ifdef KERNEL_SOLARIS
-#include <sys/swap.h>
-#endif /* KERNEL_SOLARIS */
+#if HAVE_SYS_SWAP_H
+# include <sys/swap.h>
+#endif
 
 #undef  MAX
 #define MAX(x,y) ((x) > (y) ? (x) : (y))
@@ -82,8 +82,8 @@ static void swap_submit (unsigned long long swap_used,
 {
        char buffer[512];
 
-       if (snprintf (buffer, 512, "N:%llu:%llu:%llu:%llu", swap_used,
-                               swap_free, swap_cached, swap_resv) >= 512)
+       if (snprintf (buffer, 512, "%u:%llu:%llu:%llu:%llu", (unsigned int) curtime,
+                               swap_used, swap_free, swap_cached, swap_resv) >= 512)
                return;
 
        plugin_submit (MODULE_NAME, "-", buffer);