Page 1 of 2

bug on duration

Posted: Wed Dec 14, 2016 5:45 am
by Frédéric GRANAT
Hi,
Duration field displays negative values (.jpg attached)
Please help me.

Frederic

Re: bug on duration

Posted: Wed Dec 14, 2016 10:54 am
by rkennedy
Please show us the full output of these commands -

Code: Select all

grep "date.timezone" /etc/php.ini
ls -l /etc/localtime
php -r 'echo date("D M j G:i:s T Y")."\n";'
date
mysql -unagiosxi -pn@gweb -e "SELECT NOW();"
It is important, that all of these times line up to be the same. Is your database hosted local, or offloaded?

Re: bug on duration

Posted: Thu Dec 15, 2016 3:14 am
by Frédéric GRANAT
Hi,
Here it is :

Code: Select all

[nagios@nagiosxi root]$ grep "date.timezone" /etc/php.ini
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = America/New_York
You have new mail in /var/spool/mail/root
[nagios@nagiosxi root]$ ls -l /etc/localtime
-rw-r--r--. 1 root root 2945 Dec  1 14:57 /etc/localtime
[nagios@nagiosxi root]$ php -r 'echo date("D M j G:i:s T Y")."\n";'
Thu Dec 15 3:11:28 EST 2016
[nagios@nagiosxi root]$ date
Thu Dec 15 09:11:55 CET 2016
[nagios@nagiosxi root]$ mysql -unagiosxi -pn@gweb -e "SELECT NOW();"
+---------------------+
| NOW()               |
+---------------------+
| 2016-12-15 09:12:11 |
+---------------------+
[nagios@nagiosxi root]$

Re: bug on duration

Posted: Thu Dec 15, 2016 10:29 am
by rkennedy
[nagios@nagiosxi root]$ php -r 'echo date("D M j G:i:s T Y")."\n";'
Thu Dec 15 3:11:28 EST 2016
[nagios@nagiosxi root]$ date
Thu Dec 15 09:11:55 CET 2016
[nagios@nagiosxi root]$ mysql -unagiosxi -pn@gweb -e "SELECT NOW();"
+---------------------+
| NOW() |
+---------------------+
| 2016-12-15 09:12:11 |
+---------------------+
[nagios@nagiosxi root]$
It looks like your timezones are set to EST, and CET, and off quite a bit - you'll want to set all these to be the same timezone, whichever one your prefer. Take a look at this doc for information on how to do so - https://assets.nagios.com/downloads/nag ... 1444063497

Re: bug on duration

Posted: Wed Jan 04, 2017 5:59 am
by Frédéric GRANAT
Hi,
I performed the steps :
1) Setting the System Timezone
2) PHP Timezone

set to Europe/Paris

That solved my problem (negative duration).

Remark : if I perform date I have : Wed Jan 4 11:52:33 CET 2017

Is it a problem to have CET whereas I set Europe in previous steps ?

Rgds,

frederic

Re: bug on duration

Posted: Wed Jan 04, 2017 10:40 am
by rkennedy
date should be showing the output of your EU timezone if you changed it, there's a script located at /usr/local/nagiosxi/scripts/change_timezone.sh that should help take care of it.

You can see odd issues if all of the timezones don't match up, as different components may rely on date, where as others rely on php's date/time.

Re: bug on duration

Posted: Thu Jan 05, 2017 5:19 am
by Frédéric GRANAT
Hi,
Please tell me how to use that script.

Frederic

Re: bug on duration

Posted: Thu Jan 05, 2017 2:58 pm
by tgriep
If you want to set your server to the Paris timezone, you would run the command like the example below.

Code: Select all

/usr/local/nagiosxi/scripts/change_timezone.sh  --zone Europe/Paris
Try that and let us know if the issue is resolved.

Re: bug on duration

Posted: Mon Jan 09, 2017 3:56 am
by Frédéric GRANAT
Hi,
Done, but it still shows CET when running date :

Code: Select all

[root@nagiosxi ~]# /usr/local/nagiosxi/scripts/change_timezone.sh  --zone Europe/Paris
Reloading httpd:
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
All timezone configurations updated to "Europe/Paris"

[root@nagiosxi ~]# date
Mon Jan  9 09:56:04 CET 2017
[root@nagiosxi ~]#

Re: bug on duration

Posted: Mon Jan 09, 2017 9:54 am
by tgriep
The ./etc/localtime file probably did not get changed then. Try these instructions in the link below and that should get the time setup on the server so all of the timezones are the same.
https://assets.nagios.com/downloads/nag ... m_Time.pdf