Page 1 of 1

Graphs show local time rather than host time

Posted: Thu Apr 21, 2016 1:52 pm
by gormank
That may not make much sense, but our systems use UTC, as do the Nagios servers. Users looking at graphs see their local machine time in the graphs. Since we're in 3 timezones, 3 people looking at the same graph at the same moment may see up to 3 different times. Attached is a graph from a minute ago that shows the last time as 1:30pm, but the server time is 6 hours later.

I'd prefer that the graphs use the same time as the Nagios servers but don't know how or if it can be changed...

Re: Graphs show local time rather than host time

Posted: Thu Apr 21, 2016 4:55 pm
by ssax
*** Note: This will get reverted if you upgrade and will need to be reimplemented.
*** Make sure that you have known-good backups/vm snapshots before making any modifications

I have not tested the ramifications of changing all of them, it seems to work but please run it on a test system first to make sure that it has no other impact.

You can manually change these to useUTC: true:

Code: Select all

[root@ssc66xi ~]# grep -R useUTC /usr/local/nagiosxi/html/includes
/usr/local/nagiosxi/html/includes/components/capacityplanning/includes/capacityreport.js.php:            useUTC: false
/usr/local/nagiosxi/html/includes/components/bandwidthreport/templates/timeline.inc.php:            global: { useUTC: false },
/usr/local/nagiosxi/html/includes/components/graphexplorer/templates/perfdata.inc.php:            global: { useUTC: false },
/usr/local/nagiosxi/html/includes/components/graphexplorer/templates/timeline.inc.php:            global: { useUTC: false },
/usr/local/nagiosxi/html/includes/components/graphexplorer/templates/multistack.inc.php:            global: { useUTC: false },
/usr/local/nagiosxi/html/includes/components/metrics/templates/metrics_template.inc.php:            global: { useUTC: false },
Or you can change them all in one go:

Code: Select all

find /usr/local/nagiosxi/html/includes -type f -print0 | xargs -0 sed -i 's/useUTC: false/useUTC: true/g'

Re: Graphs show local time rather than host time

Posted: Fri Apr 22, 2016 12:36 pm
by gormank
Thanks for the info.
Unfortunately our test system is a ways from being usable.

Re: Graphs show local time rather than host time

Posted: Fri Apr 22, 2016 1:06 pm
by tmcdonald
Can always take and XI backup first and do it in production:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

but this is not something I can really recommend officially.