Re: [collectd] How often does Collectd read resolv.conf?

2015-06-05 Thread Dan Fandrich
On Fri, Jun 05, 2015 at 11:38:05AM +0200, Markus Shorty Uckelmann wrote:
 Am 30.05.2015 um 19:55 schrieb Florian Forster:
 Hi Shorty,
 
 Peace octo,
 
 Thanks for the explanation.
 
 the write_graphite plugin will call getaddrinfo(3) on every connection
 attempt. How the name resolution is done depends on the C library – on
 many GNU/Linux systems DNS is one of multiple possibilities, for
 example.
 
 If /etc/resolv.conf is read, if it is re-read when modified and so on is
 out of our control, unfortunately.
 
 Would be systemd-resolved of any help here? I haven't looked into it. Just a
 guess.

Note that IIRC glibc (and probably other resolver libraries) will reread
/etc/resolv.conf when res_init() is called, so it's possible for the
application to have some say in when it's reread.

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] curl Plugin holds connections open

2014-11-14 Thread Dan Fandrich
On Thu, Nov 13, 2014 at 03:19:17PM -0800, Mark Juric wrote:
 Hello all,
 I have an issue with the curl plugin. I'm collecting at 60 second intervals
 from a web page on localhost, and it appears the connection is being held open
 in between queries. For most situations this is okay, but I have a large
 application installation that runs a reaper process to kill stuck Apache
 threads. If I'm connected to a stuck thread that gets reaped, my connection
 remains open and all future collections fail. The only solution is to
 completely restart collectd.
 
 Is this a configurable option? The overhead of a new server connection every 
 60
 seconds is negligible in my application, but the implications of losing data
 collection even though the demon continues to run are troubling.

libcurl provides a way to accomplish this (the CURLOPT_FORBID_REUSE option) but
it's not exposed by collectd. However, this shouldn't be necessary; libcurl
will detect when a socket is closed and automatically open a new connection in
that case. If the socket isn't actually closed, it's a different story. One of
the timeout options or the TCP keepalive option should be enabled to catch that
situation, but neither of those are exposed by collectd, either.

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] Strange Time value in notification test

2014-06-18 Thread Dan Fandrich
On Wed, Jun 18, 2014 at 06:50:44PM +0100, George B. wrote:
 I have configured a simple test notification using the Exec plugin. This 
 works, however, the Time value in the notification message is changed into 
 something strange (1.307) - can anyone suggest why this is happening?

Maybe it's a coincidence, but if 1403113649 were in bytes, it would be exactly
1.307 GiB.  Maybe a conversion gone wrong somewhere?

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] Variables in collectd.conf

2014-03-27 Thread Dan Fandrich
This patch seems to have been forgotten in the year since I posted it. I've
rebased it against HEAD, slightly improved it and am attaching it again.

On Wed, Apr 10, 2013 at 02:30:18PM +0200, Yves Mettier wrote:
 Hello,
 
 Probably useful. I like it.
 
 Regards,
 Yves
 
 Le 2013-04-09 22:23, Dan Fandrich a écrit :
 Any comments on this patch?
 
 Dan
 
 The default collectd.conf file created for me by autoconf from the
 collectd.conf.in file contains this for the first four entries with
 variable
 substitutions:
 
 #BaseDir ${prefix}/var/lib/collectd
 #PIDFile ${prefix}/var/run/collectd.pid
 #PluginDir   ${exec_prefix}/lib/collectd
 #TypesDB /usr/local/share/collectd/types.db
 
 That is, all but the last contains variable references like
 ${prefix}. Needless to say, collectd doesn't expand these references
 and it ends up creating files in directories named literally
 ${prefix}. Looking at the autoconf output, it appears that all
 autoconf
 substitution variables except for @prefix@ do this, and some (like
 @execdir@) go through two levels of variable indirection.
 
 It looks like this is by design, as the autoconf documentation says
 ...you should not use these variables except in makefiles. The
 workaround
 they suggest is to use sed to do the variable substitution manually
 for each
 desired variable, instead of using AC_CONFIG_FILES.
 
 The attached patch changes collectd to use the specified method of
 replacing
 the directory variables.
 
 Dan
From 4b149cdf4748d4c686b5f65cd1e67ec2df08d753 Mon Sep 17 00:00:00 2001
From: Dan Fandrich d...@coneharvesters.com
Date: Sat, 2 Mar 2013 13:08:01 +0100
Subject: [PATCH] collectd.conf: Fixed the installation directory paths

These variables are designed to be used from within a makefile,
so they must be substituted from a script called from there.
---
 configure.ac  | 13 ++--
 src/Makefile.am   | 13 
 src/{collectd.conf.in = collectd.conf.in.in} | 30 +--
 3 files changed, 39 insertions(+), 17 deletions(-)
 rename src/{collectd.conf.in = collectd.conf.in.in} (97%)

diff --git a/configure.ac b/configure.ac
index f1c7b8a..2fbf96c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5365,9 +5365,18 @@ AC_SUBST(LCC_VERSION_PATCH)
 AC_SUBST(LCC_VERSION_EXTRA)
 AC_SUBST(LCC_VERSION_STRING)
 
-AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
+AC_CONFIG_FILES(
+   Makefile
+   src/Makefile
+   src/collectd.conf.in
+   src/libcollectdclient/Makefile
+   src/libcollectdclient/collectd/lcc_features.h
+   src/libcollectdclient/libcollectdclient.pc
+   src/liboconfig/Makefile
+   bindings/Makefile
+   bindings/java/Makefile
+)
 
-AC_CONFIG_FILES([Makefile src/Makefile src/collectd.conf 
src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc 
src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile])
 AC_OUTPUT
 
 if test x$with_librrd = xyes \
diff --git a/src/Makefile.am b/src/Makefile.am
index a9d8582..4ac08d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1441,6 +1441,10 @@ collectd_LDADD += -dlopen zfs_arc.la
 collectd_DEPENDENCIES += zfs_arc.la
 endif
 
+collectd_conf_DATA = collectd.conf
+collectd_confdir =
+CLEANFILES += collectd.conf
+
 BUILT_SOURCES += $(dist_man_MANS)
 
 dist_man_MANS = collectd.1 \
@@ -1517,6 +1521,15 @@ riemann.pb-c.c riemann.pb-c.h: riemann.proto
protoc-c -I$(srcdir) --c_out . $(srcdir)/riemann.proto
 endif
 
+# This is the autoconf-recommended way to substitute build path variables
+# instead of AC_CONFIG_FILES
+collectd.conf: collectd.conf.in
+   $(SED) -e 's|@localstatedir_conf[@]|$(localstatedir)|' \
+  -e 's|@libdir_conf[@]|$(libdir)|' \
+  -e 's|@prefix_conf[@]|$(prefix)|' \
+  -e 's|@sysconfdir_conf[@]|$(sysconfdir)|' \
+  $ collectd.conf.tmp.  mv -f collectd.conf.tmp. $@
+
 install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
diff --git a/src/collectd.conf.in b/src/collectd.conf.in.in
similarity index 97%
rename from src/collectd.conf.in
rename to src/collectd.conf.in.in
index 830add9..8513292 100644
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in.in
@@ -12,10 +12,10 @@
 
 #Hostnamelocalhost
 #FQDNLookup   true
-#BaseDir @localstatedir@/lib/@PACKAGE_NAME@
-#PIDFile @localstatedir@/run/@PACKAGE_NAME@.pid
-#PluginDir   @libdir@/@PACKAGE_NAME@
-#TypesDB @prefix@/share/@PACKAGE_NAME@/types.db
+#BaseDir @localstatedir_conf@/lib/@PACKAGE_NAME@
+#PIDFile @localstatedir_conf@/run/@PACKAGE_NAME@.pid
+#PluginDir   @libdir_conf@/@PACKAGE_NAME@
+#TypesDB @prefix_conf@/share/@PACKAGE_NAME@/types.db
 
 ##
 # When enabled, plugins are loaded automatically with the default options#
@@ -278,7 +278,7

Re: [collectd] [PATCH] Removed the use of -Werror when compiling with gcc

2014-03-27 Thread Dan Fandrich
I got some feedback (a long time ago now) that removing -Werror altogether
wasn't desirable because of the benefit it adds to the collectd project in
shipping code that compiles without warnings. But, I still feel that just about
anyone other than the developers finds it annoying when their build breaks on a
newer compiler for no good reason. So, this new patch instead adds a configure
option to allow users to drop the -Werror option if desired.

 Dan
From 46dc71732287117879936d7b6be58a5f6f0ee50d Mon Sep 17 00:00:00 2001
From: Dan Fandrich d...@coneharvesters.com
Date: Thu, 27 Mar 2014 23:58:47 +0100
Subject: [PATCH] configure.ac: add --disable-warning-as-error option

While the goal of building warning-free is noble, always
erroring out on warnings makes the build too brittle with
ever-changing warning behaviour in newer versions of gcc.
---
 configure.ac  | 20 +---
 src/Makefile.am   |  2 +-
 src/libcollectdclient/Makefile.am |  2 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index f1c7b8a..5fe1a10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -585,11 +585,25 @@ AC_CHECK_FUNCS(gettimeofday select strdup strtol 
getaddrinfo getnameinfo strchr
 
 AC_FUNC_STRERROR_R
 
+AC_ARG_ENABLE(warning-as-error,
+ AS_HELP_STRING([--disable-warning-as-error],
+[stop treating compile warnings as errors on gcc]),
+ if test x$enableval = xyes
+ then
+CFLAG_ERROR=-Werror
+ else
+CFLAG_ERROR=
+ fi
+ ,
+ CFLAG_ERROR=-Werror
+)
+AC_SUBST(CFLAG_ERROR)
+
 SAVE_CFLAGS=$CFLAGS
 # Emulate behavior of src/Makefile.am
 if test x$GCC = xyes
 then
-   CFLAGS=$CFLAGS -Wall -Werror
+   CFLAGS=$CFLAGS -Wall $CFLAG_ERROR
 fi
 
 AC_CACHE_CHECK([for strtok_r],
@@ -718,7 +732,7 @@ AC_CHECK_FUNCS(getutxent, [have_getutxent=yes], 
[have_getutxent=no])
 if test x$GCC = xyes
 then
SAVE_CFLAGS=$CFLAGS
-   CFLAGS=$CFLAGS -Wall -Wextra -Werror
+   CFLAGS=$CFLAGS -Wall -Wextra $CFLAG_ERROR
 fi
 
 AC_CHECK_FUNCS(strptime, [have_strptime=yes], [have_strptime=no])
@@ -3225,7 +3239,7 @@ then
SAVE_LDFLAGS=$LDFLAGS
# trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
# (see issues #41 and #42)
-   CFLAGS=$CFLAGS $PERL_CFLAGS -Wall -Werror
+   CFLAGS=$CFLAGS $PERL_CFLAGS -Wall $CFLAG_ERROR
LDFLAGS=$LDFLAGS $PERL_LDFLAGS
 
AC_CACHE_CHECK([for broken Perl_load_module()],
diff --git a/src/Makefile.am b/src/Makefile.am
index a9d8582..459eecc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,7 @@ SUBDIRS += liboconfig
 endif
 
 if COMPILER_IS_GCC
-AM_CFLAGS = -Wall -Werror
+AM_CFLAGS = -Wall $(CFLAG_ERROR)
 endif
 
 AM_CPPFLAGS = -DPREFIX='${prefix}'
diff --git a/src/libcollectdclient/Makefile.am 
b/src/libcollectdclient/Makefile.am
index 1d4dff5..2a086c5 100644
--- a/src/libcollectdclient/Makefile.am
+++ b/src/libcollectdclient/Makefile.am
@@ -1,7 +1,7 @@
 AUTOMAKE_OPTIONS = foreign no-dependencies
 
 if COMPILER_IS_GCC
-AM_CFLAGS = -Wall -Werror
+AM_CFLAGS = -Wall $(CFLAG_ERROR)
 endif
 
 pkginclude_HEADERS = collectd/client.h collectd/network.h 
collectd/network_buffer.h collectd/lcc_features.h
-- 
1.8.1.5

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] curl_json plugin not sending data

2014-02-14 Thread Dan Fandrich
On Fri, Feb 14, 2014 at 09:29:14AM -0200, Mariano González wrote:
 I've implemented curl_jason plugin to recolect and send LoadBalancer metrics 
 to
 my RabbitMQ to be graphed in Graphite.
 Thing is, it's not sending any data, while it is working just fine (and great)
 with other plugins like memory, cpu, df root, network, etc. 

What isn't sending data where? The curl_json plugin to the URL that has been
configured? Could it be that the SSL certificate isn't properly verified so
curl aborts the connection with a verification error before it sends the
request? Or do you mean the curl_json plugin data isn't ending up in RabbitMQ?

 troubleshoot following this suggestion: 
 http://serverfault.com/questions/499378
 /collectd-stores-nan-instead-of-correct-value-in-ubuntu-12-04, but there're no
 issues coming out.
 
 Here's my collectd.conf: https://gist.github.com/Mariano-gon/8732467

Most of these gists give me a 404 error.

 
 Here're the last lines of collectd.log when I start it: 
 https://gist.github.com
 /Mariano-gon/8732488
 
 The request is made against Rackspace API where my LoadBalancer is located, 
 and
 if run manually, the curl gets me a json response perfectly normal.
 
 Here's a snippet of it: https://gist.github.com/Mariano-gon/8732518
 
 Finally, collectd does not create any new folders besides network, df, memory,
 cpu, etc (all plugins that are correctly working and sending data) when
 started.
 
 I've tested the manual connection using curl -v and got this:
 https://gist.github.com/marianogg9/8999583
 
 Hope this info helps and any comment will be really appreciated.
 Thanks!

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] Building RPM on AWS - RPATH failures

2014-01-20 Thread Dan Fandrich
On Mon, Jan 20, 2014 at 05:31:37PM +, Dan Scott wrote:
 I'm trying to build the RPMs of the latest collectd (5.4.0) for AWS Linux.
 
 I'm basing my .spec file on the existing AWS spec file (5.0).
 
 The compile and link is running fine, but I'm getting a few failures for RPATH
 (below). Anyone have any ideas? I've tried using the disable-rpath option for
 the configure, but I still receive the same error.

What configure options is this build using?

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] Plugin Exec generate no data

2013-10-22 Thread Dan Fandrich
On Tue, Oct 22, 2013 at 04:12:18PM +0200, Frederic Daguenet wrote:
 On a Citrix XenServer runs collectd 4.10.3. The collectd data are send
 to an collectd server on another machine in the local net here.
 The values for the activate plugins interface, load, memory and swap
 are corretd send. But the also activated plugin Exec no.
 
 If i start the script on command line it generates this data:
 PUTVAL skyxen3/exec-ipmi/temperature-chasis interval=60 N:39
 PUTVAL skyxen3/exec-ipmi/temperature-chasis interval=60 N:39
 PUTVAL skyxen3/exec-ipmi/temperature-chasis interval=60 N:39
 PUTVAL skyxen3/exec-ipmi/temperature-chasis interval=60 N:39
 
 and so on...
 
 The script run not as root user!

But what happens when you manually run the script as the user 
collectduser and default group collectduser?  If there are permission
problems (e.g. collectduser isn't listed in sudoers) running under that user,
which is how collectd will run the plugin, then it will naturally have
problems.  Have you tried instrumenting your script with debug logging to see
if it's called and what's going on?

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] Java API for collectd

2013-08-02 Thread Dan Fandrich
On Fri, Aug 02, 2013 at 11:38:23PM +0100, Hasna SABAH wrote:
 I am working on plugins for collectd and I am particularily interested in
 coding in java.
 I installed collectd with the package manager (yum) which doesn't include java
 api by default. Is there a rpm package for that (fedora) ?  or should I
 re-install every thing from the source ?

Fedora doesn't seem to enable the Java plugin, so you'll have to compile it
yourself from source.

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] some issues in collectd while configure postgresql plugin

2013-07-31 Thread Dan Fandrich
On Wed, Jul 31, 2013 at 05:01:03AM +, Summer Tong (chutong) wrote:
 Starting collectd: ERROR: lt_dlopen (/opt/collectd/lib/collectd/
 postgresql.so) failed: file not found. The most common cause for this problem
 are missing dependencies. Use ldd(1) to check the dependencies of the plugin /
 shared object.
 
 [  OK  ]
 
 Actually under /opt/collectd/lib/collectd, “postgresql.so” this file existed.

What is the output of ldd /opt/collectd/lib/collectd/postgresql.so If there
are still missing libraries, that should show you.

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] [PATCH 2/5] sigrok: bare bones plugin

2013-07-22 Thread Dan Fandrich
On Mon, Jul 22, 2013 at 06:21:18PM +0200, Bert Vermeulen wrote:
 +static int plugin_config(const char *key, const char *value)
 +{
 +
 + if (!strcmp(key, loglevel))
 + loglevel = atoi(value);
 + else if (!strcmp(key, conn))
 + conn = strdup(value);

This will leak memory if the config file defines these elements more than once.

 + else if (!strcmp(key, serialcomm))
 + serialcomm = strdup(value);

Here too.

 + else
 + return 1;
 +
 + return 0;
 +}
 +
 +static int plugin_init(void)
 +{
 + int ret;
 +
 + sr_log_callback_set(cd_logger, NULL);
 + sr_log_loglevel_set(loglevel);
 +
 + if ((ret = sr_init(sr_ctx)) != SR_OK) {
 + INFO(Failed to initialize libsigrok: %s., sr_strerror(ret));
 + return 1;
 + }
 +
 + return 0;
 +}
 +
 +static int plugin_read(user_data_t *ud)
 +{
 +
 + return 0;
 +}

Personally, I don't see the need to split this patch up into several pieces. A
skeleton by itself isn't very useful to review.

 +
 +static int plugin_shutdown(void)
 +{
 + if (conn)
 + free(conn);
 + if (serialcomm)
 + free(serialcomm);

The if check for NULL is not needed, as free is guaranteed to be able to handle 
it.

 +
 + sr_exit(sr_ctx);
 +
 + return 0;
 +}

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] Variables in collectd.conf

2013-04-09 Thread Dan Fandrich
Any comments on this patch?

 Dan
---BeginMessage---
The default collectd.conf file created for me by autoconf from the
collectd.conf.in file contains this for the first four entries with variable
substitutions:

#BaseDir ${prefix}/var/lib/collectd
#PIDFile ${prefix}/var/run/collectd.pid
#PluginDir   ${exec_prefix}/lib/collectd
#TypesDB /usr/local/share/collectd/types.db

That is, all but the last contains variable references like
${prefix}. Needless to say, collectd doesn't expand these references
and it ends up creating files in directories named literally
${prefix}. Looking at the autoconf output, it appears that all autoconf
substitution variables except for @prefix@ do this, and some (like
@execdir@) go through two levels of variable indirection.

It looks like this is by design, as the autoconf documentation says
...you should not use these variables except in makefiles. The workaround
they suggest is to use sed to do the variable substitution manually for each
desired variable, instead of using AC_CONFIG_FILES.

The attached patch changes collectd to use the specified method of replacing
the directory variables.

 Dan
From cb6f9bd1dfd50cfcc1a2759fdcedf3aee30ad4f8 Mon Sep 17 00:00:00 2001
From: Dan Fandrich d...@coneharvesters.com
Date: Sat, 2 Mar 2013 13:08:01 +0100
Subject: [PATCH 1/2] collectd.conf: Fixed the installation directory paths

These variables are designed to be used from within a makefile,
so they must be substituted from a script called from there.
Also, removed the use of obsolete AC_OUTPUT parameters.
---
 configure.in  |   14 +++---
 src/Makefile.am   |   12 
 src/{collectd.conf.in = collectd.conf.in.in} |   20 ++--
 3 files changed, 33 insertions(+), 13 deletions(-)
 rename src/{collectd.conf.in = collectd.conf.in.in} (97%)

diff --git a/configure.in b/configure.in
index 1492ba2..6572a19 100644
--- a/configure.in
+++ b/configure.in
@@ -5121,9 +5121,17 @@ AC_SUBST(LCC_VERSION_PATCH)
 AC_SUBST(LCC_VERSION_EXTRA)
 AC_SUBST(LCC_VERSION_STRING)
 
-AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
-
-AC_OUTPUT(Makefile src/Makefile src/collectd.conf 
src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc 
src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
+AC_CONFIG_FILES(
+   src/libcollectdclient/collectd/lcc_features.h
+   Makefile
+   src/Makefile
+   src/collectd.conf.in
+   src/libcollectdclient/Makefile
+   src/libcollectdclient/libcollectdclient.pc
+   src/liboconfig/Makefile
+   bindings/Makefile
+   bindings/java/Makefile)
+AC_OUTPUT
 
 if test x$with_librrd = xyes \
 test x$librrd_threadsafe != xyes
diff --git a/src/Makefile.am b/src/Makefile.am
index 8f8fafe..c41afb3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1371,6 +1371,10 @@ collectd_LDADD += -dlopen zfs_arc.la
 collectd_DEPENDENCIES += zfs_arc.la
 endif
 
+collectd_conf_DATA = collectd.conf
+collectd_confdir =
+CLEANFILES += collectd.conf
+
 BUILT_SOURCES += $(dist_man_MANS)
 
 dist_man_MANS = collectd.1 \
@@ -1432,6 +1436,14 @@ pinba.pb-c.c pinba.pb-c.h: pinba.proto
 riemann.pb-c.c riemann.pb-c.h: riemann.proto
protoc-c -I$(srcdir) --c_out . $(srcdir)/riemann.proto
 
+# This is the autoconf-recommended way to substitute build path variables
+# instead of AC_CONFIG_FILES
+collectd.conf: collectd.conf.in
+   $(SED) -e 's|@localstatedir_canon[@]|$(localstatedir)|' \
+  -e 's|@libdir_canon[@]|$(libdir)|' \
+  -e 's|@prefix_canon[@]|$(prefix)|' \
+  $ collectd.conf.tmp.  mv -f collectd.conf.tmp. $@
+
 install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
diff --git a/src/collectd.conf.in b/src/collectd.conf.in.in
similarity index 97%
rename from src/collectd.conf.in
rename to src/collectd.conf.in.in
index 9d8e688..c64bdc5 100644
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in.in
@@ -12,10 +12,10 @@
 
 #Hostnamelocalhost
 #FQDNLookup   true
-#BaseDir @localstatedir@/lib/@PACKAGE_NAME@
-#PIDFile @localstatedir@/run/@PACKAGE_NAME@.pid
-#PluginDir   @libdir@/@PACKAGE_NAME@
-#TypesDB @prefix@/share/@PACKAGE_NAME@/types.db
+#BaseDir @localstatedir_canon@/lib/@PACKAGE_NAME@
+#PIDFile @localstatedir_canon@/run/@PACKAGE_NAME@.pid
+#PluginDir   @libdir_canon@/@PACKAGE_NAME@
+#TypesDB @prefix_canon@/share/@PACKAGE_NAME@/types.db
 
 ##
 # Interval at which to query values. This may be overwritten on a per-plugin #
@@ -250,7 +250,7 @@
 #/Plugin
 
 #Plugin csv
-#  DataDir @localstatedir@/lib/@PACKAGE_NAME@/csv
+#  DataDir @localstatedir_canon@/lib/@PACKAGE_NAME@/csv
 #  StoreRates false
 #/Plugin
 
@@ -364,7 +364,7 @@
 #/Plugin
 
 #Plugin email
-#  SocketFile @localstatedir@/run

Re: [collectd] Mysql plugin works very strange

2013-03-21 Thread Dan Fandrich
On Thu, Mar 21, 2013 at 02:48:35PM +, Benjamin Wang (gendwang) wrote:
   When I setup collectd and mysql, there are 5 rrd files generated for
 mysql_commands as following:
 
 mysql_commands-admin_commands.rrd
 mysql_commands-select.rrd
 mysql_commands-show_databases.rrd
 mysql_commands-show_master_status.rrd
 mysql_commands-show_status.rrd
  
 
 Then I reboot the machine, two strange things happen:
 
 1.  mysql_commands-show_master_status.rrd will not be updated
 2.  There are 3 more rrd files generated(mysql_commands-change_db.rrd,
 mysql_commands-show_fields.rrd, mysql_commands-show_tables.rrd)

Are you sure that the same binary and same config files are being used in both
cases? Are you starting collectd manually in the first case and relying on
system startup scripts for the second?

 Dan

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] curl_xml plugin: Fixed typo in documentation

2013-03-21 Thread Dan Fandrich
---
 src/collectd.conf.pod |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 4449351..6598580 100644
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -1092,7 +1092,7 @@ host name setting.
 Use IInstance as the plugin instance when submitting values. Defaults to an
 empty string (no plugin instance).
 
-=item BNamespaces IPrefix IURL
+=item BNamespace IPrefix IURL
 
 If an XPath expression references namespaces, they must be specified
 with this option. IPrefix is the namespace prefix used in the XML document.
-- 
1.7.10



pgpaEcOnNPRnV.pgp
Description: PGP signature
___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] Get rid of a compiler warning with gcc 4.6.3

2013-03-18 Thread Dan Fandrich
...a futile warning that nevertheless kills the build thanks
to -Werror: variable 'status' set but not used
---
 src/utils_rrdcreate.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c
index 3b8f342..a34e0da 100644
--- a/src/utils_rrdcreate.c
+++ b/src/utils_rrdcreate.c
@@ -463,9 +463,8 @@ static int lock_file (char const *filename) /* {{{ */
 return (EEXIST);
   }
 
-  errno = 0;
   status = stat (filename, sb);
-  if (errno != ENOENT)
+  if ((status == 0) || (errno != ENOENT))
   {
 pthread_mutex_unlock (async_creation_lock);
 return (EEXIST);
-- 
1.7.10


___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] Fix automatic link flags with libgcrypt 1.5.0

2013-03-03 Thread Dan Fandrich
AM_PATH_LIBGCRYPT from libgcrypt 1.5.0 sets the variables
LIBGCRYPT_CPPFLAGS and LIBGCRYPT_LIBS with their proper
values, not GCRYPT_CPPFLAGS and GCRYPT_LIBS.
---
 configure.in |2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure.in b/configure.in
index 7c55827..dce572f 100644
--- a/configure.in
+++ b/configure.in
@@ -1831,6 +1831,8 @@ then
 
if test $with_libgcrypt != no; then
AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt=no (version 1.2.0+ 
required))
+   GCRYPT_CPPFLAGS=$LIBGCRYPT_CPPFLAGS
+   GCRYPT_LIBS=$LIBGCRYPT_LIBS
fi
 fi
 
-- 
1.7.10


___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] src/filter_chain.c: Fixed typos in error messages

2013-03-03 Thread Dan Fandrich
---
 src/filter_chain.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/filter_chain.c b/src/filter_chain.c
index ed2df61..7d8369b 100644
--- a/src/filter_chain.c
+++ b/src/filter_chain.c
@@ -92,7 +92,7 @@ static void fc_free_matches (fc_match_t *m) /* {{{ */
 (*m-proc.destroy) (m-user_data);
   else if (m-user_data != NULL)
   {
-ERROR (Filter sybsystem: fc_free_matches: There is user data, but no 
+ERROR (Filter subsystem: fc_free_matches: There is user data, but no 
 destroy functions has been specified. 
 Memory will probably be lost!);
   }
@@ -112,7 +112,7 @@ static void fc_free_targets (fc_target_t *t) /* {{{ */
 (*t-proc.destroy) (t-user_data);
   else if (t-user_data != NULL)
   {
-ERROR (Filter sybsystem: fc_free_targets: There is user data, but no 
+ERROR (Filter subsystem: fc_free_targets: There is user data, but no 
 destroy functions has been specified. 
 Memory will probably be lost!);
   }
-- 
1.7.10


___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] Variables in collectd.conf

2013-03-03 Thread Dan Fandrich
The default collectd.conf file created for me by autoconf from the
collectd.conf.in file contains this for the first four entries with variable
substitutions:

#BaseDir ${prefix}/var/lib/collectd
#PIDFile ${prefix}/var/run/collectd.pid
#PluginDir   ${exec_prefix}/lib/collectd
#TypesDB /usr/local/share/collectd/types.db

That is, all but the last contains variable references like
${prefix}. Needless to say, collectd doesn't expand these references
and it ends up creating files in directories named literally
${prefix}. Looking at the autoconf output, it appears that all autoconf
substitution variables except for @prefix@ do this, and some (like
@execdir@) go through two levels of variable indirection.

It looks like this is by design, as the autoconf documentation says
...you should not use these variables except in makefiles. The workaround
they suggest is to use sed to do the variable substitution manually for each
desired variable, instead of using AC_CONFIG_FILES.

The attached patch changes collectd to use the specified method of replacing
the directory variables.

 Dan
From cb6f9bd1dfd50cfcc1a2759fdcedf3aee30ad4f8 Mon Sep 17 00:00:00 2001
From: Dan Fandrich d...@coneharvesters.com
Date: Sat, 2 Mar 2013 13:08:01 +0100
Subject: [PATCH 1/2] collectd.conf: Fixed the installation directory paths

These variables are designed to be used from within a makefile,
so they must be substituted from a script called from there.
Also, removed the use of obsolete AC_OUTPUT parameters.
---
 configure.in  |   14 +++---
 src/Makefile.am   |   12 
 src/{collectd.conf.in = collectd.conf.in.in} |   20 ++--
 3 files changed, 33 insertions(+), 13 deletions(-)
 rename src/{collectd.conf.in = collectd.conf.in.in} (97%)

diff --git a/configure.in b/configure.in
index 1492ba2..6572a19 100644
--- a/configure.in
+++ b/configure.in
@@ -5121,9 +5121,17 @@ AC_SUBST(LCC_VERSION_PATCH)
 AC_SUBST(LCC_VERSION_EXTRA)
 AC_SUBST(LCC_VERSION_STRING)
 
-AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
-
-AC_OUTPUT(Makefile src/Makefile src/collectd.conf 
src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc 
src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
+AC_CONFIG_FILES(
+   src/libcollectdclient/collectd/lcc_features.h
+   Makefile
+   src/Makefile
+   src/collectd.conf.in
+   src/libcollectdclient/Makefile
+   src/libcollectdclient/libcollectdclient.pc
+   src/liboconfig/Makefile
+   bindings/Makefile
+   bindings/java/Makefile)
+AC_OUTPUT
 
 if test x$with_librrd = xyes \
 test x$librrd_threadsafe != xyes
diff --git a/src/Makefile.am b/src/Makefile.am
index 8f8fafe..c41afb3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1371,6 +1371,10 @@ collectd_LDADD += -dlopen zfs_arc.la
 collectd_DEPENDENCIES += zfs_arc.la
 endif
 
+collectd_conf_DATA = collectd.conf
+collectd_confdir =
+CLEANFILES += collectd.conf
+
 BUILT_SOURCES += $(dist_man_MANS)
 
 dist_man_MANS = collectd.1 \
@@ -1432,6 +1436,14 @@ pinba.pb-c.c pinba.pb-c.h: pinba.proto
 riemann.pb-c.c riemann.pb-c.h: riemann.proto
protoc-c -I$(srcdir) --c_out . $(srcdir)/riemann.proto
 
+# This is the autoconf-recommended way to substitute build path variables
+# instead of AC_CONFIG_FILES
+collectd.conf: collectd.conf.in
+   $(SED) -e 's|@localstatedir_canon[@]|$(localstatedir)|' \
+  -e 's|@libdir_canon[@]|$(libdir)|' \
+  -e 's|@prefix_canon[@]|$(prefix)|' \
+  $ collectd.conf.tmp.  mv -f collectd.conf.tmp. $@
+
 install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
diff --git a/src/collectd.conf.in b/src/collectd.conf.in.in
similarity index 97%
rename from src/collectd.conf.in
rename to src/collectd.conf.in.in
index 9d8e688..c64bdc5 100644
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in.in
@@ -12,10 +12,10 @@
 
 #Hostnamelocalhost
 #FQDNLookup   true
-#BaseDir @localstatedir@/lib/@PACKAGE_NAME@
-#PIDFile @localstatedir@/run/@PACKAGE_NAME@.pid
-#PluginDir   @libdir@/@PACKAGE_NAME@
-#TypesDB @prefix@/share/@PACKAGE_NAME@/types.db
+#BaseDir @localstatedir_canon@/lib/@PACKAGE_NAME@
+#PIDFile @localstatedir_canon@/run/@PACKAGE_NAME@.pid
+#PluginDir   @libdir_canon@/@PACKAGE_NAME@
+#TypesDB @prefix_canon@/share/@PACKAGE_NAME@/types.db
 
 ##
 # Interval at which to query values. This may be overwritten on a per-plugin #
@@ -250,7 +250,7 @@
 #/Plugin
 
 #Plugin csv
-#  DataDir @localstatedir@/lib/@PACKAGE_NAME@/csv
+#  DataDir @localstatedir_canon@/lib/@PACKAGE_NAME@/csv
 #  StoreRates false
 #/Plugin
 
@@ -364,7 +364,7 @@
 #/Plugin
 
 #Plugin email
-#  SocketFile @localstatedir@/run/@PACKAGE_NAME@-email
+#  SocketFile

[collectd] [PATCH] curl_xml plugin: Allow XML element nodes to be selected for text

2013-02-06 Thread Dan Fandrich
This is a pretty basic use case, namely to select text within an XML
element, instead of just attribute values.
---
 src/curl_xml.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/curl_xml.c b/src/curl_xml.c
index 9573948..8a07881 100644
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
@@ -245,7 +245,8 @@ static xmlXPathObjectPtr cx_evaluate_xpath 
(xmlXPathContextPtr xpath_ctx, /* {{{
 
 static int cx_if_not_text_node (xmlNodePtr node) /* {{{ */
 {
-  if (node-type == XML_TEXT_NODE || node-type == XML_ATTRIBUTE_NODE)
+  if (node-type == XML_TEXT_NODE || node-type == XML_ATTRIBUTE_NODE ||
+  node-type == XML_ELEMENT_NODE)
 return (0);
 
   WARNING (curl_xml plugin: 
-- 
1.7.10



pgpQmeB5svbeI.pgp
Description: PGP signature
___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] curl_xml plugin: Added support for XML namespaces

2013-02-06 Thread Dan Fandrich
---
I didn't see any other way to use an XPath expression on a document using
namespaces, although I don't pretend to be an expert on the matter. The 
cx_register_namespaces function is a slightly-modified version from an example
program which is included with libxml2.

 src/collectd.conf.pod |7 
 src/curl_xml.c|  106 -
 2 files changed, 112 insertions(+), 1 deletion(-)

diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index e70caad..2284e2c 100644
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -1092,6 +1092,13 @@ host name setting.
 Use IInstance as the plugin instance when submitting values. Defaults to an
 empty string (no plugin instance).
 
+=item BNamespaces INamespace-list
+
+If an XPath expression references namespaces, they must be specified
+with this option. The argument is a string of the form prefix1=URI1
+prefix2=URI2 ...,
+e.g. CNamespaces s=http://schemas.xmlsoap.org/soap/envelope/;
+
 =item BUser IUser
 =item BPassword IPassword
 =item BVerifyPeer Btrue|Bfalse
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 8a07881..747e461 100644
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
@@ -28,6 +28,7 @@
 #include libxml/parser.h
 #include libxml/tree.h
 #include libxml/xpath.h
+#include libxml/xpathInternals.h
 
 #include curl/curl.h
 
@@ -72,6 +73,7 @@ struct cx_s /* {{{ */
   char *cacert;
   char *post_body;
   struct curl_slist *headers;
+  char *namespaces;
 
   CURL *curl;
   char curl_errbuf[CURL_ERROR_SIZE];
@@ -188,6 +190,7 @@ static void cx_free (void *arg) /* {{{ */
   sfree (db-cacert);
   sfree (db-post_body);
   curl_slist_free_all (db-headers);
+  sfree (db-namespaces);
 
   sfree (db);
 } /* }}} void cx_free */
@@ -254,6 +257,98 @@ static int cx_if_not_text_node (xmlNodePtr node) /* {{{ */
   return -1;
 } /* }}} cx_if_not_text_node */
 
+/**
+ * cx_register_namespaces:
+ * @xpath_ctx: the pointer to an XPath context.
+ * @nslist:the list of known namespaces in
+ * prefix1=href1 prefix2=href2 ... format.
+ *
+ * Registers namespaces from @nslist in @xpath_ctx.
+ *
+ * Returns 0 on success and a negative value otherwise.
+ *
+ * author: Aleksey Sanin
+ *
+ * The following license statement applies to the function
+ * cx_register_namespaces only:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is fur-
+ * nished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FIT-
+ * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+ * DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+ * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Daniel Veillard shall not
+ * be used in advertising or otherwise to promote the sale, use or other deal-
+ * ings in this Software without prior written authorization from him.
+ */
+static int cx_register_namespaces(xmlXPathContextPtr xpath_ctx, /* {{{ */
+const xmlChar* nslist)
+{
+xmlChar* nslistdup;
+xmlChar* prefix;
+xmlChar* href;
+xmlChar* next;
+
+assert(xpath_ctx);
+assert(nslist);
+
+nslistdup = xmlStrdup(nslist);
+if(nslistdup == NULL) {
+ERROR (curl_xml plugin: 
+  unable to strdup namespaces list);
+   return (-1);
+}
+
+next = nslistdup;
+while(next != NULL) {
+   /* skip spaces */
+   while((*next) == ' ') next++;
+   if((*next) == '\0') break;
+
+   /* find prefix */
+   prefix = next;
+   next = (xmlChar*)xmlStrchr(next, '=');
+   if(next == NULL) {
+ERROR (curl_xml plugin: 
+  invalid namespaces list format);
+   xmlFree(nslistdup);
+   return (-1);
+   }
+   *(next++) = '\0';
+
+   /* find href */
+   href = next;
+   next = (xmlChar*)xmlStrchr(next, ' ');
+   if(next != NULL) {
+   *(next++) = '\0';
+   }
+
+   /* do register namespace */
+   if(xmlXPathRegisterNs(xpath_ctx, prefix, href) != 0) {
+ERROR (curl_xml plugin: 
+  unable to register NS with prefix=\%s\ and href=\%s\\n,
+   prefix, href);
+   xmlFree(nslistdup);
+   return 

[collectd] [PATCH] curl_xml plugin: Check for a curl_easy_perform() error first

2013-02-06 Thread Dan Fandrich
The value of CURLINFO_RESPONSE_CODE isn't valid otherwise.
Also, use the symbolic name CURLE_OK in all plugins where
appropriate.
---
 src/apache.c |2 +-
 src/ascent.c |2 +-
 src/bind.c   |2 +-
 src/curl.c   |2 +-
 src/curl_json.c  |2 +-
 src/curl_xml.c   |   13 ++---
 src/nginx.c  |2 +-
 src/write_http.c |2 +-
 8 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/apache.c b/src/apache.c
index e562138..8458ce1 100644
--- a/src/apache.c
+++ b/src/apache.c
@@ -612,7 +612,7 @@ static int apache_read_host (user_data_t *user_data) /* {{{ 
*/
assert (st-curl != NULL);
 
st-apache_buffer_fill = 0;
-   if (curl_easy_perform (st-curl) != 0)
+   if (curl_easy_perform (st-curl) != CURLE_OK)
{
ERROR (apache: curl_easy_perform failed: %s,
st-apache_curl_error);
diff --git a/src/ascent.c b/src/ascent.c
index 2378386..94a3938 100644
--- a/src/ascent.c
+++ b/src/ascent.c
@@ -597,7 +597,7 @@ static int ascent_read (void) /* {{{ */
   }
 
   ascent_buffer_fill = 0;
-  if (curl_easy_perform (curl) != 0)
+  if (curl_easy_perform (curl) != CURLE_OK)
   {
 ERROR (ascent plugin: curl_easy_perform failed: %s,
 ascent_curl_error);
diff --git a/src/bind.c b/src/bind.c
index 7857a67..ddde840 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -1415,7 +1415,7 @@ static int bind_read (void) /* {{{ */
   }
 
   bind_buffer_fill = 0;
-  if (curl_easy_perform (curl) != 0)
+  if (curl_easy_perform (curl) != CURLE_OK)
   {
 ERROR (bind plugin: curl_easy_perform failed: %s,
 bind_curl_error);
diff --git a/src/curl.c b/src/curl.c
index cb352bf..c6e2ae9 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -645,7 +645,7 @@ static int cc_read_page (web_page_t *wp) /* {{{ */
 
   wp-buffer_fill = 0;
   status = curl_easy_perform (wp-curl);
-  if (status != 0)
+  if (status != CURLE_OK)
   {
 ERROR (curl plugin: curl_easy_perform failed with staus %i: %s,
 status, wp-curl_errbuf);
diff --git a/src/curl_json.c b/src/curl_json.c
index 1494327..2635772 100644
--- a/src/curl_json.c
+++ b/src/curl_json.c
@@ -798,7 +798,7 @@ static int cj_curl_perform (cj_t *db, CURL *curl) /* {{{ */
   curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, url);
 
   status = curl_easy_perform (curl);
-  if (status != 0)
+  if (status != CURLE_OK)
   {
 ERROR (curl_json plugin: curl_easy_perform failed with status %i: %s 
(%s),
status, db-curl_errbuf, (url != NULL) ? url : null);
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 747e461..6ffad42 100644
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
@@ -676,6 +676,12 @@ static int cx_curl_perform (cx_t *db, CURL *curl) /* {{{ */
 
   db-buffer_fill = 0; 
   status = curl_easy_perform (curl);
+  if (status != CURLE_OK)
+  {
+ERROR (curl_xml plugin: curl_easy_perform failed with status %i: %s (%s),
+   status, db-curl_errbuf, url);
+return (-1);
+  }
 
   curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, url);
   curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, rc);
@@ -688,13 +694,6 @@ static int cx_curl_perform (cx_t *db, CURL *curl) /* {{{ */
 return (-1);
   }
 
-  if (status != 0)
-  {
-ERROR (curl_xml plugin: curl_easy_perform failed with status %i: %s (%s),
-   status, db-curl_errbuf, url);
-return (-1);
-  }
-
   ptr = db-buffer;
 
   status = cx_parse_stats_xml(BAD_CAST ptr, db);
diff --git a/src/nginx.c b/src/nginx.c
index ecfb307..7568a2c 100644
--- a/src/nginx.c
+++ b/src/nginx.c
@@ -215,7 +215,7 @@ static int nginx_read (void)
 return (-1);
 
   nginx_buffer_len = 0;
-  if (curl_easy_perform (curl) != 0)
+  if (curl_easy_perform (curl) != CURLE_OK)
   {
 WARNING (nginx plugin: curl_easy_perform failed: %s, nginx_curl_error);
 return (-1);
diff --git a/src/write_http.c b/src/write_http.c
index 6b1c64a..7f5943a 100644
--- a/src/write_http.c
+++ b/src/write_http.c
@@ -88,7 +88,7 @@ static int wh_send_buffer (wh_callback_t *cb) /* {{{ */
 
 curl_easy_setopt (cb-curl, CURLOPT_POSTFIELDS, cb-send_buffer);
 status = curl_easy_perform (cb-curl);
-if (status != 0)
+if (status != CURLE_OK)
 {
 ERROR (write_http plugin: curl_easy_perform failed with 
 status %i: %s,
-- 
1.7.10



pgpwgi5HcEi35.pgp
Description: PGP signature
___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] [PATCH] Allow out-of-tree builds

2013-02-04 Thread Dan Fandrich
On Sun, Feb 03, 2013 at 01:17:24PM +0100, Florian Forster wrote:
  +AM_CPPFLAGS += -I$(top_builddir)/src/libcollectdclient/collectd
 
 Since binaries using the library need to get linked to it, and not all
 binaries are, I think I'd rather add this to the binary specific CPP
 flags, i.e.:

 collectd{_nagios,ctl,_tg}_CPPFLAGS = $(AM_CPPFLAGS) 
 -I$(top_builddir)/src/libcollectdclient/collectd

That makes perfect sense.

 I was wondering why we don't run into the same problem with the
 autogenerated src/config.h. I believe the reason is the
 AC_CONFIG_HEADERS() macro which, I believe, adds $(top_builddir)/src to
 the include list. 

That sounds like a reasonable assumption. It does look like it's happening
automatically.

 My attempts to solving this problem using this macro
 failed, however, because it seems that the semantic of
 AC_CONFIG_HEADERS() and AC_CONFIG_FILES() differ quite dramatically: The
 former doesn't expand the @FOO@ placeholders, making the macro unusable
 for the use-case of lcc_features.h.
 
 It seems, because I fail to parse the documentation. It reads:
 
 Make AC_OUTPUT create the file(s) in the blank-or-newline-separated
 list header containing C preprocessor #define statements, and replace
 ‘@DEFS@’ in generated files with -DHAVE_CONFIG_H instead of the value of
 DEFS.
 
 Do you happen to have an idea if I'm doing something wrong here? I think
 adding the builddir to the include paths is probably going to be the
 easiest and most straight forward solution and I'll do that for now.

If your hypothesis is correct, then I don't see another way. It's automake
that's doing this, not autoconf, which means that it must be treating
some macros specially. If it doesn't give AC_CONFIG_FILES this special
treatment, then that path will have to be added manually. Which I don't
think is an ugly solution.

 Dan


pgpPjmJNdA44F.pgp
Description: PGP signature
___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] Add protection from infinite redirect loops to curl-using plugins

2013-02-04 Thread Dan Fandrich
---
 src/apache.c |1 +
 src/ascent.c |1 +
 src/bind.c   |1 +
 src/curl.c   |1 +
 src/nginx.c  |1 +
 5 files changed, 5 insertions(+)

diff --git a/src/apache.c b/src/apache.c
index 202b73c..e562138 100644
--- a/src/apache.c
+++ b/src/apache.c
@@ -426,6 +426,7 @@ static int init_host (apache_t *st) /* {{{ */
 
curl_easy_setopt (st-curl, CURLOPT_URL, st-url);
curl_easy_setopt (st-curl, CURLOPT_FOLLOWLOCATION, 1L);
+   curl_easy_setopt (st-curl, CURLOPT_MAXREDIRS, 50L);
 
if (st-verify_peer != 0)
{
diff --git a/src/ascent.c b/src/ascent.c
index 3a7c393..2378386 100644
--- a/src/ascent.c
+++ b/src/ascent.c
@@ -562,6 +562,7 @@ static int ascent_init (void) /* {{{ */
 
   curl_easy_setopt (curl, CURLOPT_URL, url);
   curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
 
   if ((verify_peer == NULL) || IS_TRUE (verify_peer))
 curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L);
diff --git a/src/bind.c b/src/bind.c
index 288949a..7857a67 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -1399,6 +1399,7 @@ static int bind_init (void) /* {{{ */
   curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, bind_curl_error);
   curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
   curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
 
   return (0);
 } /* }}} int bind_init */
diff --git a/src/curl.c b/src/curl.c
index 69a5b95..30d6e45 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -378,6 +378,7 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
   curl_easy_setopt (wp-curl, CURLOPT_ERRORBUFFER, wp-curl_errbuf);
   curl_easy_setopt (wp-curl, CURLOPT_URL, wp-url);
   curl_easy_setopt (wp-curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (wp-curl, CURLOPT_MAXREDIRS, 50L);
 
   if (wp-user != NULL)
   {
diff --git a/src/nginx.c b/src/nginx.c
index b76f25b..ecfb307 100644
--- a/src/nginx.c
+++ b/src/nginx.c
@@ -144,6 +144,7 @@ static int init (void)
   }
 
   curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
 
   if ((verify_peer == NULL) || IS_TRUE (verify_peer))
   {
-- 
1.7.10


___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] curl* plugins: Added support for POST and arbitrary headers

2013-02-04 Thread Dan Fandrich
These plugins can now be used for things like SOAP or XML-RPC calls.
---
 src/collectd.conf.pod |   41 -
 src/curl.c|   29 +
 src/curl_json.c   |   28 
 src/curl_xml.c|   28 
 4 files changed, 105 insertions(+), 21 deletions(-)

diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 70bc997..e70caad 100644
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -944,6 +944,19 @@ File that holds one or more SSL certificates. If you want 
to use HTTPS you will
 possibly need this option. What CA certificates come bundled with Clibcurl
 and are checked by default depends on the distribution you use.
 
+=item BHeader IHeader
+
+A HTTP header to add to the request. Multiple headers are added if this option
+is specified more than once.
+
+=item BPost IBody
+
+Specifies that the HTTP operation should be a POST instead of a GET. The
+complete data to be posted is given as the argument.  This option will usually
+need to be accompanied by a BHeader option to set an appropriate
+CContent-Type for the post body (e.g. to
+Capplication/x-www-form-urlencoded).
+
 =item BMeasureResponseTime Btrue|Bfalse
 
 Measure response time for the request. If this setting is enabled, BMatch
@@ -1002,31 +1015,15 @@ The following options are valid within BURL blocks:
 Sets the plugin instance to IInstance.
 
 =item BUser IName
-
-Username to use if authorization is required to read the page.
-
 =item BPassword IPassword
-
-Password to use if authorization is required to read the page.
-
 =item BVerifyPeer Btrue|Bfalse
-
-Enable or disable peer SSL certificate verification. See
-Lhttp://curl.haxx.se/docs/sslcerts.html for details. Enabled by default.
-
 =item BVerifyHost Btrue|Bfalse
-
-Enable or disable peer host name verification. If enabled, the plugin checks if
-the CCommon Name or a CSubject Alternate Name field of the SSL certificate
-matches the host name provided by the BURL option. If this identity check
-fails, the connection is aborted. Obviously, only works when connecting to a
-SSL enabled server. Enabled by default.
-
 =item BCACert Ifile
+=item BHeader IHeader
+=item BPost IBody
 
-File that holds one or more SSL certificates. If you want to use HTTPS you will
-possibly need this option. What CA certificates come bundled with Clibcurl
-and are checked by default depends on the distribution you use.
+These options behave exactly equivalent to the appropriate options of the
+IcURL plugin. Please see there for a detailed description.
 
 =back
 
@@ -1100,9 +1097,11 @@ empty string (no plugin instance).
 =item BVerifyPeer Btrue|Bfalse
 =item BVerifyHost Btrue|Bfalse
 =item BCACert ICA Cert File
+=item BHeader IHeader
+=item BPost IBody
 
 These options behave exactly equivalent to the appropriate options of the
-IcURL and IcURL-JSON plugins. Please see there for a detailed description.
+IcURL plugin. Please see there for a detailed description.
 
 =item EltBXPath IXPath-expressionEgt
 
diff --git a/src/curl.c b/src/curl.c
index 30d6e45..cb352bf 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -60,6 +60,8 @@ struct web_page_s /* {{{ */
   int   verify_peer;
   int   verify_host;
   char *cacert;
+  struct curl_slist *headers;
+  char *post_body;
   int   response_time;
 
   CURL *curl;
@@ -148,6 +150,8 @@ static void cc_web_page_free (web_page_t *wp) /* {{{ */
   sfree (wp-pass);
   sfree (wp-credentials);
   sfree (wp-cacert);
+  sfree (wp-post_body);
+  curl_slist_free_all (wp-headers);
 
   sfree (wp-buffer);
 
@@ -173,6 +177,23 @@ static int cc_config_add_string (const char *name, char 
**dest, /* {{{ */
   return (0);
 } /* }}} int cc_config_add_string */
 
+static int cc_config_append_string (const char *name, struct curl_slist 
**dest, /* {{{ */
+oconfig_item_t *ci)
+{
+  if ((ci-values_num != 1) || (ci-values[0].type != OCONFIG_TYPE_STRING))
+  {
+WARNING (curl plugin: `%s' needs exactly one string argument., name);
+return (-1);
+  }
+
+  *dest = curl_slist_append(*dest, ci-values[0].value.string);
+  if (*dest == NULL)
+return (-1);
+
+  return (0);
+} /* }}} int cc_config_append_string */
+
+
 static int cc_config_set_boolean (const char *name, int *dest, /* {{{ */
 oconfig_item_t *ci)
 {
@@ -405,6 +426,10 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
   wp-verify_host ? 2L : 0L);
   if (wp-cacert != NULL)
 curl_easy_setopt (wp-curl, CURLOPT_CAINFO, wp-cacert);
+  if (wp-headers != NULL)
+curl_easy_setopt (wp-curl, CURLOPT_HTTPHEADER, wp-headers);
+  if (wp-post_body != NULL)
+curl_easy_setopt (wp-curl, CURLOPT_POSTFIELDS, wp-post_body);
 
   return (0);
 } /* }}} int cc_page_init_curl */
@@ -466,6 +491,10 @@ static int cc_config_add_page (oconfig_item_t *ci) /* {{{ 
*/
 else if (strcasecmp (Match, child-key) == 0)
   /* Be liberal with failing matches = don't set `status'. */
   cc_config_add_match 

[collectd] A couple of collectd crashes

2013-02-04 Thread Dan Fandrich
I managed to get collectd to segfault in a couple of places while playing
with it a bit. The first is in the curl_xml module when the XPATH expression
doesn't quite match the input. The crash occurs on line 407 when
instance_node-nodeTab[0] is dereferenced. At this point, all members of
instance_node are 0, so dereferencing the array isn't a good idea. This patch
fixes the problem, although I'm not sure if this particular case actually
deserves its own error message:

diff --git a/src/curl_xml.c b/src/curl_xml.c
index 2a36608..2b1d247 100644
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
@@ -385,7 +385,7 @@ static int cx_handle_instance_xpath (xmlXPathContextPtr 
xpath_ctx, /* {{{ */
 instance_node = instance_node_obj-nodesetval;
 tmp_size = (instance_node) ? instance_node-nodeNr : 0;
 
-if ( (tmp_size == 0)  (is_table) )
+if (tmp_size == 0)
 {
   WARNING (curl_xml plugin: 
   relative xpath expression for 'InstanceFrom' \%s\ doesn't match 

The second problem occurred once in stop_write_threads() during shutdown, in 
this
loop:

for (q = write_queue_head; q != NULL; q = q-next)
{
plugin_value_list_free (q-vl);
sfree (q);
i++;
}

Once q has been freed by sfree(), it's no longer safe to dereference in the
for statement. I'm attaching a fix for that.

On a side note, the check for NULL in sfree() isn't actually necessary--ANSI C
specifies that free() must be safe when given a NULL pointer.

 Dan
From 43ed73d243635a86e5e72da434092f578d593269 Mon Sep 17 00:00:00 2001
From: Dan Fandrich d...@coneharvesters.com
Date: Mon, 4 Feb 2013 23:59:41 +0100
Subject: [PATCH] Fix a NULL pointer dereference during shutdown

---
 src/plugin.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/plugin.c b/src/plugin.c
index 7037234..942f8bf 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -810,10 +810,12 @@ static void stop_write_threads (void) /* {{{ */
 
 	pthread_mutex_lock (write_lock);
 	i = 0;
-	for (q = write_queue_head; q != NULL; q = q-next)
+	for (q = write_queue_head; q != NULL; )
 	{
+		write_queue_t *q1 = q;
 		plugin_value_list_free (q-vl);
-		sfree (q);
+		q = q-next;
+		sfree (q1);
 		i++;
 	}
 	write_queue_head = NULL;
-- 
1.7.10



pgpV4CmAY7ouh.pgp
Description: PGP signature
___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] [PATCH] curl* plugins: Added support for POST and arbitrary headers

2013-02-04 Thread Dan Fandrich
On Mon, Feb 04, 2013 at 02:36:17PM -0800, Kimo Rosenbaum wrote:
 Would you mind creating a pull request 
 (https://github.com/collectd/collectd/pulls)? (or attach as an attachment)
 
 
 I would like to try this patch but I think my email client is eating it up.

Here it is as an attachment.

 Dan
From 70367b8a715d6e865066c5b0d8ca0ef23a9c46ff Mon Sep 17 00:00:00 2001
From: Dan Fandrich d...@coneharvesters.com
Date: Sat, 2 Feb 2013 23:50:13 +0100
Subject: [PATCH] curl* plugins: Added support for POST and arbitrary headers

These plugins can now be used for things like SOAP or XML-RPC calls.
---
 src/collectd.conf.pod |   41 -
 src/curl.c|   29 +
 src/curl_json.c   |   28 
 src/curl_xml.c|   28 
 4 files changed, 105 insertions(+), 21 deletions(-)

diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 70bc997..e70caad 100644
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -944,6 +944,19 @@ File that holds one or more SSL certificates. If you want to use HTTPS you will
 possibly need this option. What CA certificates come bundled with Clibcurl
 and are checked by default depends on the distribution you use.
 
+=item BHeader IHeader
+
+A HTTP header to add to the request. Multiple headers are added if this option
+is specified more than once.
+
+=item BPost IBody
+
+Specifies that the HTTP operation should be a POST instead of a GET. The
+complete data to be posted is given as the argument.  This option will usually
+need to be accompanied by a BHeader option to set an appropriate
+CContent-Type for the post body (e.g. to
+Capplication/x-www-form-urlencoded).
+
 =item BMeasureResponseTime Btrue|Bfalse
 
 Measure response time for the request. If this setting is enabled, BMatch
@@ -1002,31 +1015,15 @@ The following options are valid within BURL blocks:
 Sets the plugin instance to IInstance.
 
 =item BUser IName
-
-Username to use if authorization is required to read the page.
-
 =item BPassword IPassword
-
-Password to use if authorization is required to read the page.
-
 =item BVerifyPeer Btrue|Bfalse
-
-Enable or disable peer SSL certificate verification. See
-Lhttp://curl.haxx.se/docs/sslcerts.html for details. Enabled by default.
-
 =item BVerifyHost Btrue|Bfalse
-
-Enable or disable peer host name verification. If enabled, the plugin checks if
-the CCommon Name or a CSubject Alternate Name field of the SSL certificate
-matches the host name provided by the BURL option. If this identity check
-fails, the connection is aborted. Obviously, only works when connecting to a
-SSL enabled server. Enabled by default.
-
 =item BCACert Ifile
+=item BHeader IHeader
+=item BPost IBody
 
-File that holds one or more SSL certificates. If you want to use HTTPS you will
-possibly need this option. What CA certificates come bundled with Clibcurl
-and are checked by default depends on the distribution you use.
+These options behave exactly equivalent to the appropriate options of the
+IcURL plugin. Please see there for a detailed description.
 
 =back
 
@@ -1100,9 +1097,11 @@ empty string (no plugin instance).
 =item BVerifyPeer Btrue|Bfalse
 =item BVerifyHost Btrue|Bfalse
 =item BCACert ICA Cert File
+=item BHeader IHeader
+=item BPost IBody
 
 These options behave exactly equivalent to the appropriate options of the
-IcURL and IcURL-JSON plugins. Please see there for a detailed description.
+IcURL plugin. Please see there for a detailed description.
 
 =item EltBXPath IXPath-expressionEgt
 
diff --git a/src/curl.c b/src/curl.c
index 30d6e45..cb352bf 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -60,6 +60,8 @@ struct web_page_s /* {{{ */
   int   verify_peer;
   int   verify_host;
   char *cacert;
+  struct curl_slist *headers;
+  char *post_body;
   int   response_time;
 
   CURL *curl;
@@ -148,6 +150,8 @@ static void cc_web_page_free (web_page_t *wp) /* {{{ */
   sfree (wp-pass);
   sfree (wp-credentials);
   sfree (wp-cacert);
+  sfree (wp-post_body);
+  curl_slist_free_all (wp-headers);
 
   sfree (wp-buffer);
 
@@ -173,6 +177,23 @@ static int cc_config_add_string (const char *name, char **dest, /* {{{ */
   return (0);
 } /* }}} int cc_config_add_string */
 
+static int cc_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
+oconfig_item_t *ci)
+{
+  if ((ci-values_num != 1) || (ci-values[0].type != OCONFIG_TYPE_STRING))
+  {
+WARNING (curl plugin: `%s' needs exactly one string argument., name);
+return (-1);
+  }
+
+  *dest = curl_slist_append(*dest, ci-values[0].value.string);
+  if (*dest == NULL)
+return (-1);
+
+  return (0);
+} /* }}} int cc_config_append_string */
+
+
 static int cc_config_set_boolean (const char *name, int *dest, /* {{{ */
 oconfig_item_t *ci)
 {
@@ -405,6 +426,10 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
   wp-verify_host ? 2L : 0L);
   if (wp-cacert != NULL

Re: [collectd] A couple of collectd crashes

2013-02-04 Thread Dan Fandrich
On Tue, Feb 05, 2013 at 12:02:17AM +0100, Dan Fandrich wrote:
 I managed to get collectd to segfault in a couple of places while playing
 with it a bit. The first is in the curl_xml module when the XPATH expression
 doesn't quite match the input. 

I've spotted some other questionable code around there.
cx_handle_instance_xpath() line 362 unconditionally clears the block starting
at vl-type_instance, but only at line 368 does it check if that's a NULL
pointer. Also, line 387 sets tmp_size to 0 if instance_node is NULL, then
exits the function on line 395. Then, way down at line 420, it checks
if instance_node is NULL and treats it differently, but it cannot be NULL
at that point. Clearly, the logic in this module needs some love. I don't
quite feel so bad now in failing to get my XPATH configuration right on the
first try!

 Dan


pgpVmPkRvlq21.pgp
Description: PGP signature
___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] curl's numeric options are always at minimum long, never int

2013-02-01 Thread Dan Fandrich
This can affect portability to some architectures.
---
 src/apache.c |   12 ++--
 src/ascent.c |   12 ++--
 src/bind.c   |4 ++--
 src/curl.c   |8 
 src/curl_json.c  |6 +++---
 src/curl_xml.c   |2 +-
 src/nginx.c  |   12 ++--
 src/write_http.c |6 +++---
 8 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/apache.c b/src/apache.c
index c31dd87..202b73c 100644
--- a/src/apache.c
+++ b/src/apache.c
@@ -373,7 +373,7 @@ static int init_host (apache_t *st) /* {{{ */
return (-1);
}
 
-   curl_easy_setopt (st-curl, CURLOPT_NOSIGNAL, 1);
+   curl_easy_setopt (st-curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (st-curl, CURLOPT_WRITEFUNCTION, 
apache_curl_callback);
curl_easy_setopt (st-curl, CURLOPT_WRITEDATA, st);
 
@@ -425,24 +425,24 @@ static int init_host (apache_t *st) /* {{{ */
}
 
curl_easy_setopt (st-curl, CURLOPT_URL, st-url);
-   curl_easy_setopt (st-curl, CURLOPT_FOLLOWLOCATION, 1);
+   curl_easy_setopt (st-curl, CURLOPT_FOLLOWLOCATION, 1L);
 
if (st-verify_peer != 0)
{
-   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYPEER, 1);
+   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYPEER, 1L);
}
else
{
-   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYPEER, 0);
+   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYPEER, 0L);
}
 
if (st-verify_host != 0)
{
-   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYHOST, 2);
+   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYHOST, 2L);
}
else
{
-   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYHOST, 0);
+   curl_easy_setopt (st-curl, CURLOPT_SSL_VERIFYHOST, 0L);
}
 
if (st-cacert != NULL)
diff --git a/src/ascent.c b/src/ascent.c
index 993e480..3a7c393 100644
--- a/src/ascent.c
+++ b/src/ascent.c
@@ -539,7 +539,7 @@ static int ascent_init (void) /* {{{ */
 return (-1);
   }
 
-  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ascent_curl_callback);
   curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME/PACKAGE_VERSION);
   curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, ascent_curl_error);
@@ -561,17 +561,17 @@ static int ascent_init (void) /* {{{ */
   }
 
   curl_easy_setopt (curl, CURLOPT_URL, url);
-  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
 
   if ((verify_peer == NULL) || IS_TRUE (verify_peer))
-curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1);
+curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L);
   else
-curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
+curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0L);
 
   if ((verify_host == NULL) || IS_TRUE (verify_host))
-curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2);
+curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2L);
   else
-curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0);
+curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0L);
 
   if (cacert != NULL)
 curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);
diff --git a/src/bind.c b/src/bind.c
index 5b7d7a0..288949a 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -1393,12 +1393,12 @@ static int bind_init (void) /* {{{ */
 return (-1);
   }
 
-  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, bind_curl_callback);
   curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME/PACKAGE_VERSION);
   curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, bind_curl_error);
   curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
-  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
 
   return (0);
 } /* }}} int bind_init */
diff --git a/src/curl.c b/src/curl.c
index 2160b98..69a5b95 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -370,14 +370,14 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
 return (-1);
   }
 
-  curl_easy_setopt (wp-curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (wp-curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (wp-curl, CURLOPT_WRITEFUNCTION, cc_curl_callback);
   curl_easy_setopt (wp-curl, CURLOPT_WRITEDATA, wp);
   curl_easy_setopt (wp-curl, CURLOPT_USERAGENT,
   PACKAGE_NAME/PACKAGE_VERSION);
   curl_easy_setopt (wp-curl, CURLOPT_ERRORBUFFER, wp-curl_errbuf);
   curl_easy_setopt (wp-curl, CURLOPT_URL, wp-url);
-  curl_easy_setopt (wp-curl, CURLOPT_FOLLOWLOCATION, 1);
+  curl_easy_setopt (wp-curl, CURLOPT_FOLLOWLOCATION, 1L);
 
   if (wp-user != NULL)
   {
@@ -399,9 +399,9 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
 curl_easy_setopt (wp-curl, CURLOPT_USERPWD, wp-credentials);
   }
 
-  curl_easy_setopt 

[collectd] [PATCH] Allow out-of-tree builds

2013-02-01 Thread Dan Fandrich
The generated header file lcc_features.h and collectd.h cause problems
otherwise.
---
 src/Makefile.am   |1 +
 src/libcollectdclient/Makefile.am |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index f31c176..bd00029 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,6 +16,7 @@ AM_CPPFLAGS += 
-DPIDFILE='${localstatedir}/run/${PACKAGE_NAME}.pid'
 endif
 AM_CPPFLAGS += -DPLUGINDIR='${pkglibdir}'
 AM_CPPFLAGS += -DPKGDATADIR='${pkgdatadir}'
+AM_CPPFLAGS += -I$(top_builddir)/src/libcollectdclient/collectd
 
 sbin_PROGRAMS = collectd collectdmon
 bin_PROGRAMS = collectd-nagios collectdctl collectd-tg
diff --git a/src/libcollectdclient/Makefile.am 
b/src/libcollectdclient/Makefile.am
index 9fbf0d1..1d4dff5 100644
--- a/src/libcollectdclient/Makefile.am
+++ b/src/libcollectdclient/Makefile.am
@@ -11,7 +11,7 @@ nodist_pkgconfig_DATA = libcollectdclient.pc
 BUILT_SOURCES = collectd/lcc_features.h
 
 libcollectdclient_la_SOURCES = client.c network.c network_buffer.c
-libcollectdclient_la_CPPFLAGS = $(AM_CPPFLAGS)
+libcollectdclient_la_CPPFLAGS = $(AM_CPPFLAGS) 
-I$(top_builddir)/src/libcollectdclient/collectd -I$(top_srcdir)/src
 libcollectdclient_la_LDFLAGS = -version-info 1:0:0
 libcollectdclient_la_LIBADD = 
 if BUILD_WITH_LIBGCRYPT
-- 
1.7.10


___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd