Page 1 of 1
'Scheduled Downtime' page shows datetime in local time
Posted: Mon Jun 15, 2020 5:55 am
by mon-team
Hello,
the 'Home' --> 'Schedule Downtime' page shows start and end date, for every downtime, in local time instead that in UTC.
It seems to pick up the browser timezone.
Infact, on a PC set in UTC timezone start date and end date are correct but if i open that page with a PC set in local time the start/end date are in local time.
Obviouslly the datetime for the downtime have been set in utc time.
Nagios server is in UTC:
[
[email protected] API]# timedatectl
Local time: Mon 2020-06-15 10:31:49 UTC
Universal time: Mon 2020-06-15 10:31:49 UTC
RTC time: Mon 2020-06-15 10:31:49
Time zone: Etc/UTC (UTC, +0000)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
as well in the php.ini:
date.timezone = Etc/UTC
Is this a bug?
Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Mon Jun 15, 2020 11:01 am
by jbrunkow
Thankyou for providing the
system and
PHP time zone, but the time could also be defined in several other places. Can you check that as well? I do not believe that
Nagios will ask the browser for what time zone it is in. Navigate to the
Admin section using the bar on top > click
System Settings under
System Config on the left pane > and take a look at what
Timezone is set under
Timezone Settings on the
General tab of the
System Settings page. Is that set to UTC as well?
Please refer to the following linked documentation for more details on how to check and set time zones for certain components.
SYSTEM TIME DOCUMENT
Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Tue Jun 16, 2020 1:12 am
by mon-team
Hello,
i've done all checks and everything look fine:
* admin--> system settings: datetime is utc
* php-ini : datetime is UTC
* datetime on the server is UTC, and the server is in synch with an NTP server
* System profile shows also that time is UTC
I checked also the file /etc/localtime which is a symbolic link to the valid file /usr/share/zoneinfo/Etc/UTC.
Our system has also been set in UTC, every check and component shows data in this format.
I'm running a Nagios XI 5.6.1 on a CentOS 7.6.1810.
What other checks could i do?
Regards
Francesco
Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Tue Jun 16, 2020 4:08 pm
by jbrunkow
Apparently the
Scheduled Downtime feature does actually read the time from the browser. I apologize for doubting your explanation, as it turns out you were right.
You can also run the following commands as root on your machine as an alternative way to check the time zones on your system.
Code: Select all
mysql -h 127.0.0.1 -uroot -pnagiosxi -e 'SELECT NOW(); SELECT @@GLOBAL.time_zone, @@SESSION.time_zone;'
date
ls -l /etc/localtime
php -r 'echo date("D M j G:i:s T Y")."\n";'
grep "date.timezone =" /etc/php.ini
Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Wed Jun 17, 2020 5:00 am
by mon-team
Hello,
no problem, it sounded strange also to me.
Just a question: do you think this can be considered a bug? Or however a behavior to fix?
On my side i expect to see every datetime in UTC, if i set this timezone ( and in effect all datetime on my Nagios installation are aligned, in UTC).
Regards
Francesco
Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Wed Jun 17, 2020 3:35 pm
by ssax
Not a bug, the intended functionality is that it will convert the server time into whatever TZ your workstation/browser is using.
The only way around that would be to force a different TZ (UTC in this case) with a browser add-on.
I can submit a feature request on your behalf for this if you'd like? Please keep in mind that the decision to implement the enhancement is at the discretion of our development team.
Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Wed Jun 17, 2020 3:55 pm
by jbrunkow
I think that is how it is intended to work, sorry I wasn't aware of that right away.
There is quite possibly a workaround that could force XI to only use that timezone. Have you tried changing the time zone to UTC on the computer you are having issues with? I believe most browsers inherit the time zone from their host. You could also try disabling that cookie in whatever browser you are using...
We could, however, submit a request to our developers that this feature be changed in future releases. Maybe we could add an option to turn it off!

Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Thu Jun 18, 2020 1:39 am
by mon-team
Yes,
i've tried, with a browser running on a PC in UTC timezone the datetime in Schedule Downtime are in UTC.
The fact is that all our servers are in UTC, but usually (both admin and simple Nagios users) have their own PC with a different timezone. This page is the only one showing datetime based on the browser timezone.
In my opinion this is a bit confusing, however...i hope that my personal feedback can contribute to the growth and usability of Nagios XI!
Thanks for your support!
Regards,
Francesco
Re: 'Scheduled Downtime' page shows datetime in local time
Posted: Thu Jun 18, 2020 10:52 am
by jbrunkow
I have just submitted a request for this to be added to a future release. The irony is
that it looks like it was made that way by a feature request to begin with!
I will let you know if I hear anything back from them.