Page 1 of 4
Recurring Database Connection Error
Posted: Mon Oct 16, 2017 3:15 am
by venturegardengroup
Hello Support,
I have been getting a recurring database connection error issue on my Nagios XI for over 2 weeks now. The frequency is about once in 2 days. Currently even when I run the repair command on the CLI, nothing seems to happen. How can you be of help?
See screenshot attached.
Regards,
Re: Recurring Database Connection Error
Posted: Mon Oct 16, 2017 8:50 am
by eloyd
My immediate reaction is that almost 50,000 failed logins in as root in three days is a serious issue that needs to be addressed. Use a non-standard port, set up firewalls, activate fail2ban, and audit accounting output to make sure someone hasn't managed to guess your root password. That's pretty insane; you're averaging one failed login every six seconds, continuously.
My second reaction is to issue this command first:
Before executing:
Some of the XI scripts are funny and need to be run from the directory, not just called by name.
Re: Recurring Database Connection Error
Posted: Mon Oct 16, 2017 10:12 am
by kyang
Thanks
@eloyd!
@venturegardengroup, please cd into the scripts directory and then run the
./repair_databasesh.sh just as eloyd mentions.
Let us know if this works or if you have any more questions.
Re: Recurring Database Connection Error
Posted: Tue Oct 17, 2017 8:39 am
by venturegardengroup
Thanks eloyd and Kyang,
I have done exactly as requested but it is still the same issue.
@eloyd: thanks for your observation and recommendation, we are getting that fixed.
Re: Recurring Database Connection Error
Posted: Tue Oct 17, 2017 10:26 am
by kyang
Can you tell us what version of XI you have, and run this command to tell us the database.
Code: Select all
grep dbtype /usr/local/nagiosxi/html/config.inc.php
Re: Recurring Database Connection Error
Posted: Tue Oct 17, 2017 11:14 am
by venturegardengroup
Hello Kyang,
I cant seem to get the version of nagios xi since I cant log into the UI. However here is the output of the command:
[root@localhost ~]# grep dbtype /usr/local/nagiosxi/html/config.inc.php
$cfg['dbtype'] = ''; // this setting is no longer used - use settings below
"dbtype" => 'mysql',
"dbtype" => 'mysql',
"dbtype" => 'mysql',
[root@localhost ~]#
Re: Recurring Database Connection Error
Posted: Tue Oct 17, 2017 11:42 am
by dwasswa
Hi
@venturegardengroup ,
If you cant login to the web UI please follow the steps below:
1.Open an SSH or direct console session to your Nagios XI host and execute the following command:
Code: Select all
/usr/local/nagiosxi/scripts/reset_nagiosadmin_password.php --password=newpassword
Note: If you would like to use special characters in your password, you should escape them with "\". For example, if you want to set your new password to be "$new password#", then you can run:
Code: Select all
/usr/local/nagiosxi/scripts/reset_nagiosadmin_password.php --password=\$new\ password\#
2.check if iptables is started, run:
To see if port 80 is open, run:
You should see something like this:
Code: Select all
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:
Code: Select all
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save
Re: Recurring Database Connection Error
Posted: Thu Oct 19, 2017 3:13 am
by venturegardengroup
Hello Dwasswa,
The issue is with the log in is DB error related rather than with the password. See output attached.
Regards,
Re: Recurring Database Connection Error
Posted: Thu Oct 19, 2017 9:25 am
by kyang
Could you show us your mysql logs?
Re: Recurring Database Connection Error
Posted: Fri Oct 20, 2017 2:57 am
by venturegardengroup
Hello Kyang,
I couldn't find any log for mysql. See the attached output for the files and directories in /var/log.
Regards,