Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date&Time issue, bare metal in CEST timezone #27

Open
x8k opened this issue Apr 13, 2016 · 4 comments
Open

Date&Time issue, bare metal in CEST timezone #27

x8k opened this issue Apr 13, 2016 · 4 comments

Comments

@x8k
Copy link

x8k commented Apr 13, 2016

Hello, I'm experiencing a strange behavior with the plugin.
I've the bare-metal in CEST (+0200) that runs the docker plugins inside a docker image running with -v /var/run/docker.sock:/var/run/docker.sock:ro option.
The t = stats['read'] has value like "2016-04-13T14:44:03.808905789+02:00"
When the plugin run the if below use the time.mktime() function

if t:
            val.time = time.mktime(dateutil.parser.parse(t).timetuple())
        else:
            val.time = time.time()

And from documentation: The timetuple parameter given to mktime() doesn't contain any time zone information (it never does, there is no time zone field in a timetuple). Therefore the function has to "guess" which time zone it might be, and mktime() just always assumes that it is local time. That's just how the function behaves.
That means the plugin sends the metrics 2 hours in the future :)

@x8k
Copy link
Author

x8k commented Apr 13, 2016

If I remove the if and leaving the val.time = time.time()or changing time.mktime(dateutil.parser.parse(t).timetuple()) in val.time = time.mktime(dateutil.parser.parse(t ignoretz=True).timetuple()) the problem does not occurs.
I really dont know if I'm doing well

@xneo64
Copy link

xneo64 commented Jun 22, 2016

Seconded. I run my servers using a non-UTC timezone (BST), and the collected metrics are 1 hour in the future in the summer months :)

Ideally as per Collectd spec the timestamps collected would be in epoch time.

@StefanVanDyck
Copy link

Thirded. Using the ignoretz=True fix proposed by @Stregatto doesn't seem to work though.
Had to resort to using val.time = time.time() and ignoring stats['read'] altogether.

@TimonDDD
Copy link

Hello. Сan anyone know how to solve this problem? I have time for 3 hours in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants