Hi everyone,

I'm working for a registrar. We use intensively isc-bind, and since a
few month collectd's bind plugin.

We were experiencing a very specific behavior from this plugin only. The
datetime returned was shifted. After some diggin', i figured what was
the problem : the current code was not handling timesavings.

the bind plugin works like this :
 * query to xmlrpc bind webservice
 * process data : bind statistics and datetime
 * returns processed data

Since it's the only plugin returning a datetime not using timesavings i
read [1] and wrote a quick fix that :

1- substracts the constant timezone to the "about to be returned datetime"
2- adds to the result timezone and timesaving ( with *localtime() )
3- returns the result instead of the UTC datetime + timezone

I've been using this patch without a glitch ( in production ) for 2
months now. Our bind statistics are now respecting the collectd's
general behavior.

Please find attached to this email the patch.

Hoping this will help,

Aurélien

[1]  http://www.gnu.org/s/hello/manual/libc/Time-Zone-Functions.html
--- bind.c.old	2011-05-05 15:50:34.000000000 +0200
+++ bind.c	2011-05-05 15:50:10.000000000 +0200
@@ -457,6 +457,11 @@
     return (-1);
   }
 
+  time_t t = mktime(&tm) - timezone;
+
+  memset (&tm, 0, sizeof(tm));
+  tm = *localtime(&t);
+
   *ret_value = mktime(&tm);
 
   xmlXPathFreeObject (xpathObj);

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
collectd mailing list
[email protected]
http://mailman.verplant.org/listinfo/collectd

Reply via email to