bug on duration

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Frédéric GRANAT
Posts: 445
Joined: Mon Nov 19, 2012 11:36 am

bug on duration

Post by Frédéric GRANAT »

Hi,
Duration field displays negative values (.jpg attached)
Please help me.

Frederic
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: bug on duration

Post 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?
Former Nagios Employee
Frédéric GRANAT
Posts: 445
Joined: Mon Nov 19, 2012 11:36 am

Re: bug on duration

Post 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]$
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: bug on duration

Post 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
Former Nagios Employee
Frédéric GRANAT
Posts: 445
Joined: Mon Nov 19, 2012 11:36 am

Re: bug on duration

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: bug on duration

Post 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.
Former Nagios Employee
Frédéric GRANAT
Posts: 445
Joined: Mon Nov 19, 2012 11:36 am

Re: bug on duration

Post by Frédéric GRANAT »

Hi,
Please tell me how to use that script.

Frederic
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: bug on duration

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Frédéric GRANAT
Posts: 445
Joined: Mon Nov 19, 2012 11:36 am

Re: bug on duration

Post 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 ~]#
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: bug on duration

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked