Localized Time on Graphs

Anything that you think should be in Cacti.

Moderators: Moderators, Developers

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

Localized Time on Graphs

#1 Post by mmccaugh » Mon Jun 04, 2018 9:34 pm

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
tzexample.jpg
Splunk Example
tzexample.jpg (82.51 KiB) Viewed 919 times

netniV
Cacti Guru User
Posts: 2978
Joined: Sun Aug 27, 2017 12:05 am

Re: Localized Time on Graphs

#2 Post by netniV » Tue Jun 05, 2018 2:59 am

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.

mmccaugh
Cacti User
Posts: 92
Joined: Mon Apr 09, 2018 1:37 pm

Re: Localized Time on Graphs

#3 Post by mmccaugh » Wed Jun 06, 2018 11:54 am

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: 2978
Joined: Sun Aug 27, 2017 12:05 am

Re: Localized Time on Graphs

#4 Post by netniV » Thu Jun 07, 2018 12:34 pm

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.

mmccaugh
Cacti User
Posts: 92
Joined: Mon Apr 09, 2018 1:37 pm

Re: Localized Time on Graphs

#5 Post by mmccaugh » Mon Jun 11, 2018 1:22 pm

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 Pro User
Posts: 863
Joined: Mon Jan 05, 2015 10:10 am

Re: Localized Time on Graphs

#6 Post by Osiris » Thu Sep 27, 2018 2:02 am

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
Posts: 45
Joined: Tue Mar 23, 2004 1:52 pm

Re: Localized Time on Graphs

#7 Post by EBrander » Wed Nov 06, 2019 1:01 pm

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?

Post Reply