Page 1 of 1
Time
Posted: Tue Jan 01, 2013 9:59 pm
by jsmurphy
Hey guys,
Ever since the 1.2 update (currently running 1.3) I've been having some issues with the time displaying incorrectly and I've mostly managed to work through the issues on my test server but I've still got one last little issue that I don't seem to be able to correct.
From the XI interface, information retrieved from Nagios Core is displaying 11 hours behind (or exactly +0 GMT/UTC) yet everywhere else including the actual Nagios Core interface it's displaying the proper time. Info:
Date
[root@nagios ~]# date
Wed Jan 2 13:56:16 EST 2013
nagios.cfg
use_timezone=Australia/Melbourne
php.ini
date.timezone = Australia/Melbourne
apache nagios.conf
<Directory "/usr/local/nagios/sbin">
SetEnv TZ "Australia/Melbourne"
...
<Directory "/usr/local/nagios/share">
SetEnv TZ "Australia/Melbourne"
...
Nagios Core Screenshot:
nagios_time1.png
Nagios XI Screenshot:
nagios_time1.png
ideas?
Re: Time
Posted: Wed Jan 02, 2013 10:35 am
by yancy
jsmurphy,
What date format is defined in nagios.cfg?
date_format=<option>
http://nagios.sourceforge.net/docs/nagioscore-3-en.pdf
Re: Time
Posted: Wed Jan 02, 2013 5:14 pm
by jsmurphy
Hey Yancy,
date_format=euro
The date is fine, the time is the problem
Cheers,
John
Re: Time
Posted: Thu Jan 03, 2013 10:25 am
by scottwilkerson
John,
Does this machine have an offloaded MySQL server?
If so, could the date/timezone be off on the MySQL server?
It would be possible that the dates could be screwed up in XI's view as they are read from dates in the MySQL server..
Re: Time
Posted: Thu Jan 03, 2013 4:31 pm
by jsmurphy
It does have an offloaded SQL server but the time there is set correctly:
nagiossql:/home # date
Fri Jan 4 08:29:53 EST 2013
Re: Time
Posted: Thu Jan 03, 2013 5:57 pm
by nscott
I have a few questions, do ever notice the time display in the Nagios XI being on 12 hours, instead of 24? As in does it spin up past 12 and hit 13:00 hours? Because maybes its a date formatting issue and its off by an hour.
Also can you verify you're getting the right time when you login to MySQL and try:
mysql> SELECT UNIX_TIMESTAMP('2013-01-03 00:00:00');
Does that give a the *correct* timestamp? It should yield 1357192800.
Re: Time
Posted: Thu Jan 03, 2013 7:18 pm
by jsmurphy
As far as I've noticed the time is always displayed in 24 hour format in XI.
Running the requested command for the test server mysql I get the following:
mysql> SELECT UNIX_TIMESTAMP("2013-01-03 00:00:00");
+---------------------------------------+
| UNIX_TIMESTAMP("2013-01-03 00:00:00") |
+---------------------------------------+
| 1357171200 |
+---------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT NOW();
+---------------------+
| NOW() |
+---------------------+
| 2013-01-04 00:13:26 |
+---------------------+
1 row in set (0.00 sec)
Right... so MySQL definitely thinks the timezone is UTC, though it's making less and less sense by the minute:
mysql> SELECT @@global.time_zone, @@session.time_zone;
+--------------------+---------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------+---------------------+
| SYSTEM | SYSTEM |
+--------------------+---------------------+
1 row in set (0.00 sec)
[root@nagios ~]# su - mysql
-bash-4.1$ echo $TZ
Australia/Melbourne
Re: Time
Posted: Thu Jan 03, 2013 7:31 pm
by jsmurphy
Alright solved...
/etc/sysconfig/clock was set to UTC

. Now I've just got to sort out production as that seems to be a separate issue, but I think now that I know where every possible place to set the date time is it shouldn't be too hard to stamp out.
Re: Time
Posted: Thu Jan 03, 2013 10:21 pm
by nscott
Awesome, as soon as you find another place to set the time, the core committers will find a new place to make you set it.

Thanks for sharing the results js.