Page 1 of 2

Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 11:15 am
by amit.ahuja
Hi,

We are currently having trouble login to Nagios from GUI. We used the username and password, which were correct for sure, and clicked the login button. Then, the page was refreshed but sent us back to the login page again. It seems clicking on the login button just refresh the page without actually login.

Thanks in advace

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 11:21 am
by hsmith
Can you log in to core?

http://x.x.x.x./nagios instead of http://x.x.x.x/nagiosxi

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 11:36 am
by amit.ahuja
Yes, I can log into core.

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 11:42 am
by hsmith
What are the contents of /etc/httpd/conf.d/nagiosxi.conf?

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 11:49 am
by amit.ahuja
<Directory "/usr/local/nagiosxi/html">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# AuthName "Nagios XI"
# AuthType Basic
# AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
# Require valid-user
</Directory>

Alias /nagiosxi "/usr/local/nagiosxi/html"

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]
</IfModule>

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 1:59 pm
by scottwilkerson
You can reset the nagiosadmin password with the following script

Code: Select all

/usr/local/nagiosxi/scripts/reset_nagiosadmin_password.php --password=<newpassword>

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 2:22 pm
by amit.ahuja
Hi, I reset the password, but the same issue still exists. It does not seem like the password authorization problem, because it does not prompt the username or password is wrong, just refreshes the login page.

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 2:25 pm
by scottwilkerson
Did you modify any of the httpd configuration files?

Any mysql errors?

Code: Select all

tail -f /var/log/mysqld.log
Finally, you do have cookies and sessions enabled in your browser correct?

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 2:53 pm
by amit.ahuja
I did not modify any of the httpd configuration files. In mysqld.log, i saw some errors as below,

Code: Select all

160322 11:23:00 [ERROR] /usr/libexec/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13)
160322 11:23:00 [ERROR] Can't start server: can't create PID file: Permission denied
Also, I found I was not able to run /usr/local/nagiosxi/scripts/reconfigure_nagios.sh. I gave me this error.

Code: Select all

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mcrypt.so' - /usr/lib64/php/modules/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'cmd=apply&type=writeConfig' -O nagiosql.export.monitoring
--2016-03-22 15:37:13--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.export.monitoring”

    [ <=>                                                                            ] 9,860       --.-K/s   in 0.02s

2016-03-22 15:37:14 (538 KB/s) - “nagiosql.export.monitoring” saved [9860]

NAGIOSQL WRITE CONFIGS FAILED!\n
Thanks

Re: Nagios is not able to be logged in from GUI

Posted: Tue Mar 22, 2016 2:57 pm
by amit.ahuja
The only thing I did before this happens was that I changed the user of the directories in /var to nagios, then accessing web interface showed we needed to repair db. Then I changed the user back to root, then we were still not able to login.