Localized Time on Graphs

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
mmccaugh
Cacti User
Posts: 100
Joined: Mon Apr 09, 2018 1:37 pm

Localized Time on Graphs

Post by mmccaugh »

If this has been requested I apologize, but I am not seeing it.

I did see :

viewtopic.php?f=7&t=58387

But I am not sure that request was properly articulated really, as the timezone of the monitored nodes seems more or less irrelevant, but I do have a similar issue as I have users in 5 different timezones (All 4 US zones, as well as BST) I have my pollers all set to Europe/London for timezone but what would be phenomenal is if individual users were able to set their LOCAL timezone in their user profile, then when they view graphs the time is localized to them.

For instance I am in CST so it is 9:25pm currently, my graphs all show 3:25am as the current time as that is the server time on all pollers, as well as the current local time in London. What I am suggesting is that I have the option to select "MY" timezone as CST in my profile, so all displayed graphs and log data are localized to my local time automatically.

This is similar to how splunk, and other tools localize time by user but it is shown in the attached image.

All of my logging being ingested into Splunk is tagged UTC, but my users all have the option to select their timezone which allows the plunk user interface to display the localized time, not the actual timestamp.

If this is not something anyone is working on currently, and there is interest in it I may take a look myself at the level of effort to add it..
Attachments
Splunk Example
Splunk Example
tzexample.jpg (82.51 KiB) Viewed 13326 times
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Localized Time on Graphs

Post by netniV »

Currently, the time of the server dictates the times of the graphs. It is being considered for a future release but I don't believe it is being done at this time.

One thing that will be in 1.2 is that remote pollers will be able to have localised time.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
mmccaugh
Cacti User
Posts: 100
Joined: Mon Apr 09, 2018 1:37 pm

Re: Localized Time on Graphs

Post by mmccaugh »

I'm not really worried about time being localized by poller, in fact it is easier IMO if these are all aggregating data in a common timezone like UTC.

What I am proposing is that end users be able to localize the time, so if someone in CST is viewing graphs ALL the data is displayed in their local timezone, a separate user in London would see the exact same graph data but in their timezone etc...

Certainly not a critical functionality change, but it saves users from having to do any math when determining the time of the data they are looking at.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Localized Time on Graphs

Post by netniV »

Yes, like I said it's already been asked and considered. The problem is that there are quite a few fields and plugins which are not timezone aware so it could and most likely would be a breaking change hence we haven't just dropped it in.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
mmccaugh
Cacti User
Posts: 100
Joined: Mon Apr 09, 2018 1:37 pm

Re: Localized Time on Graphs

Post by mmccaugh »

That's what I was afraid of, and taking a glance I think I see what you mean.

The way Splunk (Or other log aggregation tools) store data is not the same as Cacti at all, so it isn't as simple as applying a simple +/- $local_tz_offset and having everything come out pretty! I appreciate the reply!
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: Localized Time on Graphs

Post by Osiris »

Most fields in cacti use timestamps, so viewing thing from another timezone should be pretty strait forward. I think it's just timing. This project is community driven, so finding people to contribute will help for things like this.
Before history, there was a paradise, now dust.
User avatar
EBrander
Cacti User
Posts: 52
Joined: Tue Mar 23, 2004 1:52 pm

Re: Localized Time on Graphs

Post by EBrander »

Folks in old threads are suggesting putting the PHP TZ variable in graph.php, which is of course a bad idea I think. But since it's just a variable used for building the graphs, couldn't that be stored in the DB for the user account so that each user could pick their own TZ?

Quoting viewtopic.php?f=2&t=47931#p257276
simply add this line into the file graph_image.php with your time zone
add it on the second line just under the <?php

<?php
putenv('TZ=Europe/Berlin');
Again, I think that's a bad idea, but if the line could be instead pulled from a user setting that would be ideal, something akin to (my coding is weak, please take with grain of salt):

Code: Select all

if (get_request_var('TZ')) { putenv("TZ=" . get_request_var('TZ'));}
Feasible?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Localized Time on Graphs

Post by TheWitness »

This works for Linux for sure, but not necessarily Windows. Do we care a lot about Windows right now though? I need to check, but I think this is on the roadmap already. In the mean time, ensure you keep this hack in graph_json.php, graph_image.php, graph_xport.php.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest