[collectd] Collectd bind plugin patch: timesaving problem

Bruno Prémont bonbons at linux-vserver.org
Fri Jun 24 12:28:22 CEST 2011


On Fri, 24 Jun 2011 12:10:41 Aurelien ROUGEMONT wrote:
> 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

The more simple/safe solution should be to revert timegm() -> mktime()
change done in
http://git.verplant.org/?p=collectd.git;a=commitdiff;h=1641c82ec4e14968ea31021dfb8b520df5f4483a


In your patch you refer to a "timezone" variable, where does that one
come from?
In addition, localtime() and friends depend on process-global timezone
setting which is rather bad in a multithreaded process such as collectd!

Bruno



More information about the collectd mailing list