Page 1 of 1

Time is off by exactly 6 hours

Posted: Tue Nov 21, 2017 3:53 pm
by altsysrq
Timezone that the server is supposed to be in is US Central. But Nagios is reporting everything 6 hours ahead. Here are my settings:

The following is correct (currently it is 2:31PM CST):
[root@nagios ~]# date
Tue Nov 21 14:31:46 CST 2017


[root@nagios ~]# ll /etc/localtime
lrwxrwxrwx 1 root root 30 Sep 20 09:42 /etc/localtime -> /usr/share/zoneinfo/US/Central


[root@nagios ~]# cat /etc/php.ini | grep date.time
; http://php.net/date.timezone
date.timezone = Central


Timezone in System Settings is, "Central Time."

The issue is:
* My "Service Status Detail" is always off by 6 hours. When a service should be down for 10 minutes, it says that the service has been down for "6h 10m 0s".
* "System Status" reports that it was last updated at 2017-11-21 20:32:51, when it should be 2017-11-21 14:32:51.

Is there another location for time settings that we are missing? Any other ideas?

Re: Time is off by exactly 6 hours

Posted: Tue Nov 21, 2017 4:10 pm
by lmiltchev
Try changing this:

Code: Select all

date.timezone = Central
to this:

Code: Select all

date.timezone = US/Central
in the php.ini file, and restart apache:

Code: Select all

service httpd restart
http://php.net/manual/en/timezones.others.php

If this is an option, reboot the server as well.

Are you using local or offloaded mysql db? What's the mysql time?

Code: Select all

echo 'select now();' | mysql -t -uroot -pnagiosxi mysql

Re: Time is off by exactly 6 hours

Posted: Tue Nov 21, 2017 4:14 pm
by altsysrq
Changing php.ini to US/Central fixed it actually. Thank you!

Time on mysql was correct:
+---------------------+
| now() |
+---------------------+
| 2017-11-21 15:15:56 |
+---------------------+

Re: Time is off by exactly 6 hours

Posted: Tue Nov 21, 2017 4:17 pm
by lmiltchev
I am glad I could help! :)

I am locking this topic. If you have any more questions/issues, please start a new thread. Thank you!