Home » Categories » Products » Nagios XI » Troubleshooting » Common Problems

Nagios XI - Can’t Log Into The Web Interface

Problem Description

Sometimes a user can connect to the Nagios XI server via ssh (putty) session but he/she is not able to log in to the web UI.

 

Possible Causes

There could be various reasons for this problem. Here are some of the possible causes:

  • Wrong/Lost password for the nagiosadmin user.

  • SELinux enabled (especially if it is running in enforcing mode)

  • The apache service is not running

  • The firewall (iptables) is blocking port 80

  • The mysqld service is not running or there are crashed database tables

  • The postgresql service is not running or the database is not accepting commands

  • Other products installed that use Postgres may need their databases vacuumed

 

Possible Solutions

  • Wrong/Lost password for the nagiosadmin user.

To reset the nagiosadmin's password, follow the steps in this article:

Nagios XI - Resetting The nagiosadmin Password

 

  • SELinux enabled (especially if it is running in enforcing mode)

In order to check if SELinux is disabled, run:

sestatus

 or

sestatus

 

To disable SELinux, run:

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

 

Running the above commands will turn off SELinux immediately AND make the change remain after a server reboot.

 

  • The apache service is not running

If apache is not running, you will see the following messages in the web UI: "Unable to connect" (in Firefox) or "This webpage is not available" (in Chrome).

To check if apache is started, run:

service httpd status

 

To start/restart the apache service, run:

service httpd start

or

service httpd restart

 

  • The firewall (iptables) is blocking port 80

To check if iptables is started, run:

service iptables status

 

To see if port 80 is open, run:

iptables -L -n | grep 80

 

You should see something like this:

ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80    

 

If the port is not open, you can open it by running:

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save

 

  • The mysqld service is not running or there are crashed database tables

When you try to log in the web UI and there is a problem with the MySQL database, you will most probably see an errors message similar to this one:

Message: A database connection error has been detected, we are attempting to repair the server, if the repair does not resolve the issue, please contact Nagios support.    

 

Please follow the steps in this KB article:

Nagios XI - Crashed Database Tables

 

  • The postgresql service is not running or the database is not accepting commands

If there is a problem with the posgresql, the message that you will see in the web UI would be similar to the one displayed for mysql errors. However, you will see an additional message, which would look something like this:

SQL: SQL Error [nagiosxi] : Database connection failed SQL: SQL Error [nagiosxi] : Database connection failed SQL: SQL Error [nagiosxi] : Database connection failed
Message: A database connection error has been detected, we are attempting to repair the server, if the repair does not resolve the issue, please contact Nagios support.

 

If you see this message, you will need to make sure that:

a) You are not running out of disk space

df -h
df -i

 

b) posgresql is running and you can actually log in the database manually

Try to start/restart posqgresql to see if it would start normally:

service postgresql start

or

service postgresql restart

 

Note: sometimes, you will need to run vacuum on the postgres database. The following commands are different if you are using a version of PostgreSQL before v9. To determine which version you have execute the following command:

postgres -V

Based on that output, execute the commands specific to your version:

Versions BEFORE 9

echo "vacuum;vacuum analyze;"|psql nagiosxi postgres
service postgresql restart

 

Versions 9 onwards

echo "vacuum;vacuum analyze;vacuum full;"|psql nagiosxi postgres
service postgresql restart

 

 

To log in the postgres manually, run:

psql nagiosxi nagiosxi

 

To view the tables, run:

\d

 

and to exit:

\q

 

If you tried to run the vacuum on the posgres or you attempted to log in manually in the database, but you see the following error message:

psql: FATAL:  database is not accepting commands to avoid wraparound data loss in database "postgres"
HINT:  Stop the postmaster and use a standalone backend to vacuum database "postgres".

 

You may notice either a high CPU usage for the postmaster process, or a repeated error message in the /var/lib/pgsql/data/pg_log file:

transaction ID wrap limit is 2147484146

 

You can try to fix the issue by running the following command in the command line:

Important: Run the commands one-by-one (don't run them with one go!)

Versions BEFORE PostgreSQL 9

service postgresql stop
su postgres
echo "VACUUM;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start

 

Note: The commands listed above may not work with some versions of PosgreSQL. If you see the following error:

postgres: invalid argument: "nagiosxi"

 

You will need to run the following commands instead:

service postgresql stop
su postgres
echo "VACUUM;" > /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start

 

Versions 9 Onwards

service postgresql stop
su postgres
echo "VACUUM FULL;" > /tmp/fix.sql
postgres -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start

 

Note: The commands listed above may not work with some versions of PosgreSQL. If you see the following error:

postgres: invalid argument: "nagiosxi"

 

You will need to run the following commands instead:

service postgresql stop
su postgres
echo "VACUUM FULL;" > /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data nagiosxi < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data postgres < /tmp/fix.sql
postgres --single -D /var/lib/pgsql/data template1 < /tmp/fix.sql
exit
service postgresql start

 

 

  •  Other products installed that use Postgres may need their databases vacuumed

If you have another piece of software installed on your Nagios XI server that uses Postgres, such as Nagios Fusion, you may need to vacuum the databases of that software as well as those mentioned in previous steps.  In the case of Fusion specifically, the following commands needed to be run as well as those in the previous steps:

postgres -D /var/lib/pgsql/data nagiosfusion < /tmp/fix.sql

or

postgres --single -D /var/lib/pgsql/data nagiosfusion < /tmp/fix.sql

as appropriate to the situation.

 

More information on PostgreSQL and VACUUM can be found here:

https://wiki.postgresql.org/wiki/VACUUM_FULL

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios XI - ICMP and Ping Checks Stopped Graphing
Viewed 2033 times since Mon, Jan 25, 2016
Nagios XI - Debugging Bandwidth Performance Graphs
Viewed 2936 times since Tue, Jan 27, 2015
Nagios XI - HTTP 500 Error / PHP Parse error - Unexpected $end
Viewed 1531 times since Mon, Jan 25, 2016
Nagios XI - Uploaded plugin returns "/bin/bash^M: bad interpreter: No such file or directory"
Viewed 1393 times since Thu, Feb 25, 2016
Nagios XI - ERROR: unable to open include file: /etc/mrtg/conf.d/xxxxxxx.cfg
Viewed 2074 times since Wed, Jun 1, 2016
Nagios XI - Configuration Applies, No Changes Take Place
Viewed 2158 times since Tue, Jan 27, 2015
Nagios XI - Problems Using Nagios XI With Proxies
Viewed 6231 times since Mon, Jan 25, 2016
Nagios XI - Host Still Visible After Deletion (Ghost Hosts)
Viewed 3549 times since Tue, Jan 27, 2015
Nagios XI - Crashed Database Tables
Viewed 11075 times since Tue, Jan 27, 2015
Nagios XI - Last Check Time Not Updating
Viewed 4696 times since Tue, Jan 6, 2015