Graphs show local time rather than host time

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Graphs show local time rather than host time

Post 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...
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Graphs show local time rather than host time

Post 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'
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Graphs show local time rather than host time

Post by gormank »

Thanks for the info.
Unfortunately our test system is a ways from being usable.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Graphs show local time rather than host time

Post 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.
Former Nagios employee
Locked