Sometimes, Nagios login screen redirects to itself after entering the login credentials. This generally happens due to a mismatch in the time zone.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix Nagios related errors.
In this context, we shall look into the main causes of this error and steps to tackle this error.
Nagios XI uses cookies to save session state and these are set to expire after 30 minutes. The mismatch in time between the Nagios XI server and the client's browser causes the cookies to appear expired.
We have noticed that it generally happens when the time set on the Nagios XI server is incorrect.
To solve this error, you need to fix the time on the Nagios XI server and ensure that it is correct. This approach sometimes solve this issue in most cases.
Nagios XI has a dedicated configuration section in the web GUI which does the timezone configuration. Do the following;
i. Start by navigating to Admin > System Config > System Settings.
ii. Find the Timezone Settings section (on the General tab).
iii. From the Timezone drop-down list select the timezone.
iv. Click the Update Settings button.
Even after setting the time zone via GUI, our support specialists have noticed date/time and timezone issues in some cases.
In such cases, we update the system time to resolve the issue.
The steps to update the system time varies based on the operating system used.
i. For RHEL 7|CentOS 7|Oracle Linux 7
We use the timedatectl command to configure the timezone. To display a list of available timezones, use the command:
# timedatectl list-timezones
The timezones are listed by country/city and include daylight savings time adjustments.
Then we use the timedatectl command to configure the timezone:
# timedatectl set-timezone America/Los_Angeles
Running the timedatectl command by itself will produce a summary, which will have the following line:
Time zone: America/Los_Angeles (PST, -0800)
ii. For Debian|Ubuntu
The dpkg-reconfigure command helps to configure the timezone. Use the following command to set the timezone:
# dpkg-reconfigure tzdata
Select the appropriate region and this completes the required steps.
Next, we will configure the php.ini for the timezone set above. The location of the php.ini file differs depending on the operating system/version. The following command will determine the location:
# find /etc -name php.ini
We will then open the file with a suitable text editor and change the timezone value as given below;
date.timezone = America/Los_Angeles
Finally, we will restart the Apache service:
For RHEL 7|CentOS 7|Oracle Linux 7, execute;
# systemctl restart httpd.service
For Ubuntu 14, execute;
# service apache2 restart
We will now check the timezone information by checking the XI system time by executing the following command:
# date
If the timezone is correct, but the date and/or time are incorrect we could set the proper time using the date:
# date MMDDhhmmCCYY
Where MM is the month, DD is the day, hh is the hour, mm is minute, and CCYY is the year.
Whenever we change the system time or timezone, we need to restart the database services so that they use the new date/time.
Use the postgresql command only if you are using Nagios XI pre version 5.x OR you have upgraded to version 5.x from a previous version.
For RHEL 7|CentOS 7, execute;
# systemctl stop nagios.service
# systemctl stop ndo2db.service
# service postgresql restart
# systemctl restart mariadb.service
# systemctl start ndo2db.service
# systemctl start nagios.service
For Debian|Ubuntu 16/18, run;
# systemctl stop nagios.service
# systemctl stop ndo2db.service
# service postgresql restart
# systemctl restart mysql.service
# systemctl start ndo2db.service
# systemctl start nagios.service
This article will help to resolve Nagios login screen redirecting to itself which occurs due to a mismatch in the time zone can cause the Nagios login screen to redirects to itself after entering the login credentials.