[collectd] BIND plugin for collectd-4.9.3_3

mr.a at aol.com mr.a at aol.com
Wed Jun 13 11:45:25 CEST 2012


Collectd developers--

Good day.

I am currently trying to backport the changes for "ParseTime" into 
collectd-4.9.3
(the version that is running on my production environment). Comparing 
src/bind.c
and src/collectd.conf.pod against the published patches at 
http://goo.gl/ebHUU, I
then came up with these diffs for collectd-4.9.3:

mr.a at a:/usr/ports/net-mgmt/collectd# less files/patch-src-bind.c.diff
--- ./src/bind.c.orig   2010-07-09 18:01:59.000000000 +0800
+++ ./src/bind.c        2012-06-13 09:35:57.000000000 +0800
@@ -98,6 +98,10 @@ struct list_info_ptr_s
 };
 typedef struct list_info_ptr_s list_info_ptr_t;

+/* FIXME: Enabled by default for backwards compatibility. */
+/* TODO: Remove time parsing code. */
+static _Bool config_parse_time = 1;
+
 static char *url                   = NULL;
 static int global_opcodes          = 1;
 static int global_qtypes           = 1;
@@ -249,7 +253,8 @@ static void submit (time_t ts, const char 
*plugin_instance, /* {{{ */

   vl.values = values;
   vl.values_len = 1;
-  vl.time = TIME_T_TO_CDTIME_T (ts);
+  if (config_parse_time)
+    vl.time = TIME_T_TO_CDTIME_T (ts);
   sstrncpy(vl.host, hostname_g, sizeof(vl.host));
   sstrncpy(vl.plugin, "bind", sizeof(vl.plugin));
   if (plugin_instance) {
@@ -1363,6 +1368,8 @@ static int bind_config (oconfig_item_t *ci) /* 
{{{ */
        bind_config_set_bool ("MemoryStats", &global_memory_stats, 
child);
     else if (strcasecmp ("View", child->key) == 0)
       bind_config_add_view (child);
+    else if (strcasecmp ("ParseTime", child->key) == 0)
+      cf_util_get_boolean (child, &config_parse_time);
     else
     {
       WARNING ("bind plugin: Unknown configuration option "
(END)

--- src/collectd.conf.pod.orig  2010-07-09 18:03:25.000000000 +0800
+++ src/collectd.conf.pod       2012-06-13 12:33:51.000000000 +0800
@@ -288,6 +288,7 @@

  <Plugin "bind">
    URL "http://localhost:8053/"
+   ParseTime       false
    OpCodes         true
    QTypes          true

@@ -314,35 +315,44 @@
 URL from which to retrieve the XML data. If not specified,
 C<http://localhost:8053/> will be used.

-=item B<OpCodes> I<true>|I<false>
+=item B<ParseTime> B<true>|B<false>
+
+When set to B<true>, the time provided by BIND will be parsed and used 
to
+dispatch the values. When set to B<false>, the local time source is 
queried.
+
+This setting is set to B<true> by default for backwards compatibility; 
setting
+this to B<false> is I<recommended> to avoid problems with timezones and
+localization.
+
+=item B<OpCodes> B<true>|B<false>

  When enabled, statistics about the I<"OpCodes">, for example the 
number of
 C<QUERY> packets, are collected.

 Default: Enabled.

-=item B<QTypes> I<true>|I<false>
+=item B<QTypes> B<true>|B<false>

  When enabled, the number of I<incoming> queries by query types (for 
example
 C<A>, C<MX>, C<AAAA>) is collected.

 Default: Enabled.

-=item B<ServerStats> I<true>|I<false>
+=item B<ServerStats> B<true>|B<false>

  Collect global server statistics, such as requests received over IPv4 
and IPv6,
 successful queries, and failed updates.

 Default: Enabled.

-=item B<ZoneMaintStats> I<true>|I<false>
+=item B<ZoneMaintStats> B<true>|B<false>

  Collect zone maintenance statistics, mostly information about 
notifications
 (zone updates) and zone transfers.

 Default: Enabled.

-=item B<ResolverStats> I<true>|I<false>
+=item B<ResolverStats> B<true>|B<false>

  Collect resolver statistics, i.E<nbsp>e. statistics about outgoing 
requests
  (e.E<nbsp>g. queries over IPv4, lame servers). Since the global 
resolver
@@ -371,21 +381,21 @@

 =over 4

-=item B<QTypes> I<true>|I<false>
+=item B<QTypes> B<true>|B<false>

  If enabled, the number of I<outgoing> queries by query type 
(e.E<nbsp>g. C<A>,
 C<MX>) is collected.

 Default: Enabled.

-=item B<ResolverStats> I<true>|I<false>
+=item B<ResolverStats> B<true>|B<false>

  Collect resolver statistics, i.E<nbsp>e. statistics about outgoing 
requests
 (e.E<nbsp>g. queries over IPv4, lame servers).

 Default: Enabled.

-=item B<CacheRRSets> I<true>|I<false>
+=item B<CacheRRSets> B<true>|B<false>

  If enabled, the number of entries (I<"RR sets">) in the view's cache 
by query
  type is collected. Negative entries (queries which resulted in an 
error, for

Applying the patches worked just fine.

mr.a at a:/usr/ports/net-mgmt/collectd# make clean patch
===>  Cleaning for collectd-4.9.3_3
===>  License check disabled, port has not defined LICENSE
===>  Found saved configuration for collectd-4.9.3_2
===>  Extracting for collectd-4.9.3_3
===>  Patching for collectd-4.9.3_3
===>  Applying FreeBSD patches for collectd-4.9.3_3
mr.a at a:/usr/ports/net-mgmt/collectd#

Here is the problem during installation:
# uname -s
FreeBSD
# uname -p
amd64
# uname -r
8.2-RELEASE

#head Makefile
PORTNAME=       collectd
PORTVERSION=    4.9.3
PORTREVISION=   3

/usr/ports/net-mgmt/collectd# make clean patch install package
...
libtool: link: ar cru .libs/apache.a  apache_la-apache.o
libtool: link: ranlib .libs/apache.a
libtool: link: ( cd ".libs" && rm -f "apache.la" && ln -s
"../apache.la" "apache.la" )
/bin/sh ../libtool  --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I.
-DPREFIX='"/usr/local"' -DCONFIGFILE='"/usr/local/etc/collectd.conf"'
-DLOCALSTATEDIR='"/var"' -DPKGLOCALSTATEDIR='"/var/lib/collectd"'
-DPIDFILE='"/var/run/collectd.pid"'
-DPLUGINDIR='"/usr/local/lib/collectd"'
-DPKGDATADIR='"/usr/local/share/collectd"' -I/usr/local/include -Wall
-Werror -I/usr/local/include -I/usr/local/include/libxml2
-I/usr/local/include   -O2 -pipe -fstack-protector -fno-strict-aliasing
-MT bind_la-bind.lo -MD -MP -MF .deps/bind_la-bind.Tpo -c -o
bind_la-bind.lo `test -f 'bind.c' || echo './'`bind.c
libtool: compile:  cc -DHAVE_CONFIG_H -I. -DPREFIX=\"/usr/local\"
-DCONFIGFILE=\"/usr/local/etc/collectd.conf\" -DLOCALSTATEDIR=\"/var\"
-DPKGLOCALSTATEDIR=\"/var/lib/collectd\"
-DPIDFILE=\"/var/run/collectd.pid\"
-DPLUGINDIR=\"/usr/local/lib/collectd\"
-DPKGDATADIR=\"/usr/local/share/collectd\" -I/usr/local/include -Wall
-Werror -I/usr/local/include -I/usr/local/include/libxml2
-I/usr/local/include -O2 -pipe -fstack-protector -fno-strict-aliasing
-MT bind_la-bind.lo -MD -MP -MF .deps/bind_la-bind.Tpo -c bind.c  -fPIC
-DPIC -o .libs/bind_la-bind.o
cc1: warnings being treated as errors
bind.c: In function 'submit':
bind.c:257: warning: implicit declaration of function
'TIME_T_TO_CDTIME_T'
gmake[3]: *** [bind_la-bind.lo] Error 1
gmake[3]: Leaving directory
`/home/tmp_ports/usr/xports/net-mgmt/collectd/work/collectd-4.9.3/src'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory
`/home/tmp_ports/usr/xports/net-mgmt/collectd/work/collectd-4.9.3/src'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory
`/home/tmp_ports/usr/xports/net-mgmt/collectd/work/collectd-4.9.3/src'
gmake: *** [all-recursive] Error 1
*** Error code 1

Any ideas on what went wrong here?

Thanks in advance,

mr.a





More information about the collectd mailing list