Merge pull request #1023 from ciomaire/write_kafka_ldflags
authorMarc Fournier <marc.fournier@camptocamp.com>
Tue, 19 May 2015 10:01:18 +0000 (12:01 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Tue, 19 May 2015 10:01:18 +0000 (12:01 +0200)
when --with-librdkafka arg is not a path searched by linker

configure.ac
contrib/redhat/collectd.spec
src/daemon/meta_data.c
src/java.c
src/libcollectdclient/network.c
src/libcollectdclient/network_buffer.c
src/liboconfig/oconfig.c
src/processes.c
src/swap.c
src/write_sensu.c
version-gen.sh

index e6b3693..448bb4a 100644 (file)
@@ -1190,6 +1190,7 @@ FILE *fh;
 struct mntent *me;
 fh = setmntent ("/etc/mtab", "r");
 me = getmntent (fh);
+return(me->mnt_passno);
 ]]]
                        )],
                        [c_cv_have_one_getmntent="yes"],
@@ -1209,6 +1210,7 @@ me = getmntent (fh);
                                 int status;
                                 fh = fopen ("/etc/mnttab", "r");
                                 status = getmntent (fh, &mt);
+                                return(status);
 ]]]
                        )],
                        [c_cv_have_two_getmntent="yes"],
@@ -2084,6 +2086,10 @@ fi
 
 # --with-java {{{
 with_java_home="$JAVA_HOME"
+if test "x$with_java_home" = "x"
+then
+       with_java_home="/usr/lib/jvm"
+fi
 with_java_vmtype="client"
 with_java_cflags=""
 with_java_libs=""
@@ -2108,7 +2114,7 @@ then
        if test -d "$with_java_home"
        then
                AC_MSG_CHECKING([for jni.h])
-               TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
+               TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
                if test "x$TMPVAR" != "x"
                then
                        AC_MSG_RESULT([found in $TMPVAR])
@@ -2118,7 +2124,7 @@ then
                fi
 
                AC_MSG_CHECKING([for jni_md.h])
-               TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
+               TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
                if test "x$TMPVAR" != "x"
                then
                        AC_MSG_RESULT([found in $TMPVAR])
@@ -2128,7 +2134,7 @@ then
                fi
 
                AC_MSG_CHECKING([for libjvm.so])
-               TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
+               TMPVAR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
                if test "x$TMPVAR" != "x"
                then
                        AC_MSG_RESULT([found in $TMPVAR])
@@ -2140,7 +2146,7 @@ then
                if test "x$JAVAC" = "x"
                then
                        AC_MSG_CHECKING([for javac])
-                       TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
+                       TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
                        if test "x$TMPVAR" != "x"
                        then
                                JAVAC="$TMPVAR"
@@ -2152,7 +2158,7 @@ then
                if test "x$JAR" = "x"
                then
                        AC_MSG_CHECKING([for jar])
-                       TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
+                       TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
                        if test "x$TMPVAR" != "x"
                        then
                                JAR="$TMPVAR"
@@ -3172,6 +3178,7 @@ then
 ]]],
 [[[
   int val = PCAP_ERROR_IFACE_NOT_UP;
+  return(val);
 ]]]
                       )],
                       [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
index e023a34..20f6dd5 100644 (file)
 # plugin xmms disabled, requires xmms
 %define with_xmms 0%{!?_without_xmms:0}
 
-Summary:       Statistics collection daemon for filling RRD files
+Summary:       statistics collection and monitoring daemon
 Name:          collectd
 Version:       5.4.2
 Release:       1%{?dist}
@@ -948,7 +948,7 @@ Collectd utilities
 %if %{with_dbi}
 %define _with_dbi --enable-dbi
 %else
-%define _with_dbi --disable-dbi --without-libdbi
+%define _with_dbi --disable-dbi
 %endif
 
 %if %{with_df}
@@ -1200,7 +1200,7 @@ Collectd utilities
 %if %{with_notify_email}
 %define _with_notify_email --enable-notify_email
 %else
-%define _with_notify_email --disable-notify_email --without-libesmpt
+%define _with_notify_email --disable-notify_email
 %endif
 
 %if %{with_ntpd}
@@ -1254,7 +1254,7 @@ Collectd utilities
 %if %{with_perl}
 %define _with_perl --enable-perl --with-perl-bindings="INSTALLDIRS=vendor"
 %else
-%define _with_perl --disable-perl --without-libperl
+%define _with_perl --disable-perl
 %endif
 
 %if %{with_pf}
@@ -1516,7 +1516,7 @@ Collectd utilities
 %if %{with_write_mongodb}
 %define _with_write_mongodb --enable-write_mongodb
 %else
-%define _with_write_mongodb --disable-write_mongodb --without-libmongoc
+%define _with_write_mongodb --disable-write_mongodb
 %endif
 
 %if %{with_write_redis}
@@ -1982,7 +1982,7 @@ fi
 %if %{with_thermal}
 %{_libdir}/%{name}/thermal.so
 %endif
-%if %{with_load}
+%if %{with_threshold}
 %{_libdir}/%{name}/threshold.so
 %endif
 %if %{with_unixsock}
index d3da9bb..6ee8446 100644 (file)
@@ -494,7 +494,7 @@ int meta_data_get_string (meta_data_t *md, /* {{{ */
 
   if (e->type != MD_TYPE_STRING)
   {
-    ERROR ("meta_data_get_signed_int: Type mismatch for key `%s'", e->key);
+    ERROR ("meta_data_get_string: Type mismatch for key `%s'", e->key);
     pthread_mutex_unlock (&md->lock);
     return (-ENOENT);
   }
index d0423be..2f1efbf 100644 (file)
@@ -3078,10 +3078,8 @@ static int cjni_init (void) /* {{{ */
 
   if (config_block != NULL)
   {
-
     cjni_config_perform (config_block);
     oconfig_free (config_block);
-    config_block = NULL;
   }
 
   if (jvm == NULL)
index ddb3b5b..c390a1c 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/libcollectdclient/network.c
- * Copyright (C) 2005-2013  Florian Forster
+ * Copyright (C) 2005-2015  Florian Forster
  * Copyright (C) 2010       Max Henkel
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -219,7 +219,13 @@ static int server_send_buffer (lcc_server_t *srv) /* {{{ */
   memset (buffer, 0, sizeof (buffer));
   buffer_size = sizeof (buffer);
 
-  lcc_network_buffer_finalize (srv->buffer);
+  status = lcc_network_buffer_finalize (srv->buffer);
+  if (status != 0)
+  {
+    lcc_network_buffer_initialize (srv->buffer);
+    return (status);
+  }
+
   status = lcc_network_buffer_get (srv->buffer, buffer, &buffer_size);
   lcc_network_buffer_initialize (srv->buffer);
 
index 61c7c22..343c285 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/libcollectdclient/network_buffer.c
- * Copyright (C) 2010-2012  Florian octo Forster
+ * Copyright (C) 2010-2015  Florian octo Forster
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -792,9 +792,9 @@ int lcc_network_buffer_finalize (lcc_network_buffer_t *nb) /* {{{ */
 
 #if HAVE_LIBGCRYPT
   if (nb->seclevel == SIGN)
-    nb_add_signature (nb);
+    return nb_add_signature (nb);
   else if (nb->seclevel == ENCRYPT)
-    nb_add_encryption (nb);
+    return nb_add_encryption (nb);
 #endif
 
   return (0);
index 539c9d3..bf21b90 100644 (file)
@@ -195,7 +195,7 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig)
   return (ci_copy);
 } /* oconfig_item_t *oconfig_clone */
 
-void oconfig_free (oconfig_item_t *ci)
+void oconfig_free_all (oconfig_item_t *ci)
 {
   int i;
 
@@ -214,12 +214,19 @@ void oconfig_free (oconfig_item_t *ci)
     free (ci->values);
 
   for (i = 0; i < ci->children_num; i++)
-    oconfig_free (ci->children + i);
+    oconfig_free_all (ci->children + i);
 
   if (ci->children != NULL)
     free (ci->children);
 }
 
+void oconfig_free (oconfig_item_t *ci)
+{
+  oconfig_free_all (ci);
+  free (ci);
+  ci = NULL;
+}
+
 /*
  * vim:shiftwidth=2:tabstop=8:softtabstop=2:fdm=marker
  */
index 68f30a5..5a09b57 100644 (file)
@@ -1791,7 +1791,7 @@ static int ps_read (void)
        int wait     = 0;
 
        kvm_t *kd;
-       char errbuf[1024];
+       char errbuf[_POSIX2_LINE_MAX];
        struct kinfo_proc *procs;          /* array of processes */
        struct kinfo_proc *proc_ptr = NULL;
        int count;                         /* returns number of processes */
@@ -1803,7 +1803,7 @@ static int ps_read (void)
        ps_list_reset ();
 
        /* Open the kvm interface, get a descriptor */
-       kd = kvm_open (NULL, NULL, NULL, 0, errbuf);
+       kd = kvm_openfiles (NULL, "/dev/null", NULL, 0, errbuf);
        if (kd == NULL)
        {
                ERROR ("processes plugin: Cannot open kvm interface: %s",
index 8af18f4..a8276c7 100644 (file)
@@ -157,6 +157,8 @@ static int swap_init (void) /* {{{ */
 /* #endif defined(VM_SWAPUSAGE) */
 
 #elif HAVE_LIBKVM_GETSWAPINFO
+       char errbuf[_POSIX2_LINE_MAX];
+
        if (kvm_obj != NULL)
        {
                kvm_close (kvm_obj);
@@ -165,14 +167,11 @@ static int swap_init (void) /* {{{ */
 
        kvm_pagesize = getpagesize ();
 
-       if ((kvm_obj = kvm_open (NULL, /* execfile */
-                                       NULL, /* corefile */
-                                       NULL, /* swapfile */
-                                       O_RDONLY, /* flags */
-                                       NULL)) /* errstr */
-                       == NULL)
+       kvm_obj = kvm_openfiles (NULL, "/dev/null", NULL, O_RDONLY, errbuf);
+
+       if (kvm_obj == NULL)
        {
-               ERROR ("swap plugin: kvm_open failed.");
+               ERROR ("swap plugin: kvm_openfiles failed, %s", errbuf);
                return (-1);
        }
 /* #endif HAVE_LIBKVM_GETSWAPINFO */
index 35db4f7..cb0c2fe 100644 (file)
@@ -484,18 +484,29 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
                        return NULL;
                }
        } else {
-               int64_t tmp_v;
-               if (ds->ds[index].type == DS_TYPE_DERIVE)
-                       tmp_v = (int64_t) vl->values[index].derive;
-               else if (ds->ds[index].type == DS_TYPE_ABSOLUTE)
-                       tmp_v = (int64_t) vl->values[index].absolute;
-               else
-                       tmp_v = (int64_t) vl->values[index].counter;
-               res = asprintf(&value_str, "%ld", tmp_v);
-               if (res == -1) {
-                       free(ret_str);
-                       ERROR("write_sensu plugin: Unable to alloc memory");
-                       return NULL;
+               if (ds->ds[index].type == DS_TYPE_DERIVE) {
+                       res = asprintf(&value_str, "%"PRIi64, vl->values[index].derive);
+                       if (res == -1) {
+                               free(ret_str);
+                               ERROR("write_sensu plugin: Unable to alloc memory");
+                               return NULL;
+                       }
+               }
+               else if (ds->ds[index].type == DS_TYPE_ABSOLUTE) {
+                       res = asprintf(&value_str, "%"PRIu64, vl->values[index].absolute);
+                       if (res == -1) {
+                               free(ret_str);
+                               ERROR("write_sensu plugin: Unable to alloc memory");
+                               return NULL;
+                       }
+               }
+               else {
+                       res = asprintf(&value_str, "%llu", vl->values[index].counter);
+                       if (res == -1) {
+                               free(ret_str);
+                               ERROR("write_sensu plugin: Unable to alloc memory");
+                               return NULL;
+                       }
                }
        }
 
index 7b573ab..460c6e9 100755 (executable)
@@ -10,4 +10,4 @@ fi
 
 VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`"
 
-echo -n "$VERSION"
+printf "%s" "$VERSION"