Merge branch 'collectd-5.4' into collectd-5.5
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 26 Feb 2016 21:53:19 +0000 (22:53 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 26 Feb 2016 21:53:19 +0000 (22:53 +0100)
configure.ac
src/apache.c
src/collectd.conf.in
src/modbus.c

index 8f7a4f3..ee6300a 100644 (file)
@@ -44,6 +44,7 @@ AC_SYS_LARGEFILE
 #
 AC_PROG_CC
 AC_PROG_CPP
+AC_PROG_EGREP
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
@@ -60,6 +61,18 @@ m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-conf
 
 PKG_PROG_PKG_CONFIG
 
+AC_CACHE_CHECK([if bison is the parser generator],
+       [collectd_cv_prog_bison],
+       [AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
+               [collectd_cv_prog_bison=yes], [collectd_cv_prog_bison=no]
+       )]
+)
+
+if test "x$collectd_cv_prog_bison" = "xno" && test ! -f "${srcdir}/liboconfig/parser.c"
+then
+       AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/liboconfig/parser.c. Please install bison])
+fi
+
 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
 if test "x$have_protoc_c" = "xno"
 then
index 9c4b496..c515e3c 100644 (file)
@@ -531,13 +531,16 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */
 
        st = user_data->data;
 
+       int status;
+
+       char *content_type;
+       static const char *text_plain = "text/plain";
+
        assert (st->url != NULL);
        /* (Assured by `config_add') */
 
        if (st->curl == NULL)
        {
-               int status;
-
                status = init_host (st);
                if (status != 0)
                        return (-1);
@@ -560,6 +563,16 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */
                st->server_type = APACHE;
        }
 
+       status = curl_easy_getinfo (st->curl, CURLINFO_CONTENT_TYPE, &content_type);
+       if ((status == CURLE_OK) && (content_type != NULL) &&
+           (strncasecmp (content_type, text_plain, strlen (text_plain)) != 0))
+       {
+               WARNING ("apache plugin: `Content-Type' response header is not `%s' "
+                       "(received: `%s'). Expecting unparseable data. Please check `URL' "
+                       "parameter (missing `?auto' suffix ?)",
+                       text_plain, content_type);
+       }
+
        ptr = st->apache_buffer;
        saveptr = NULL;
        while ((line = strtok_r (ptr, "\n\r", &saveptr)) != NULL)
index 07d66cd..36eca9c 100644 (file)
@@ -84,7 +84,7 @@
 # Lines beginning with a single `#' belong to plugins which have been built  #
 # but are disabled by default.                                               #
 #                                                                            #
-# Lines begnning with `##' belong to plugins which have not been built due   #
+# Lines beginning with `##' belong to plugins which have not been built due  #
 # to missing dependencies or because they have been deactivated explicitly.  #
 ##############################################################################
 
index 97b98b7..c04b308 100644 (file)
@@ -310,7 +310,9 @@ static int mb_init_connection (mb_host_t *host) /* {{{ */
   if (host == NULL)
     return (EINVAL);
 
+#if COLLECT_DEBUG
   modbus_set_debug (&host->connection, 1);
+#endif
 
   /* We'll do the error handling ourselves. */
   modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
@@ -390,7 +392,9 @@ static int mb_init_connection (mb_host_t *host) /* {{{ */
     }
   }
 
+#if COLLECT_DEBUG
   modbus_set_debug (host->connection, 1);
+#endif
 
   /* We'll do the error handling ourselves. */
   modbus_set_error_recovery (host->connection, 0);