[collectd] BIND plugin - timezone issue
Robert Mibus
mibus at mibus.org
Tue Feb 14 04:19:20 CET 2012
Hi,
I've just looked at collectd's BIND plugin; it looks like it's
specifically parsing the BIND server's date/time information and using
mktime() to convert this to a time_t for later submission. This is
causing odd issues, as collectd is logging system information
(CPU/RAM/etc) in the correct local timezone (Australia/Adelaide) but
BIND's data seems to be getting logged in what looks like UTC [or
possibly UTC+1?].
BIND is not capable of having alternate timezones set in its output,
so I can't do anything about fixing it there.
Is there any particular reason not to just use the current system's
time? ie. with the attached patch.
Presumably for this patch to be accepted, I'd need to actually strip
out all of the parsing & passing around of the "time_t ts" too - if I
were to do that, would it likely be accepted?
Thanks;
Robert.
diff --git a/src/bind.c b/src/bind.c
index b640a59..6d29303 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -249,7 +249,7 @@ 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);
+ vl.time = TIME_T_TO_CDTIME_T (time(NULL));
sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "bind", sizeof(vl.plugin));
if (plugin_instance) {
--
Robert Mibus <mibus at mibus.org>
Tech by day, geek by night
More information about the collectd
mailing list