Recurring Database Connection Error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
venturegardengroup
Posts: 62
Joined: Tue Jun 28, 2016 10:11 am

Recurring Database Connection Error

Post 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,
You do not have the required permissions to view the files attached to this post.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Recurring Database Connection Error

Post 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:

Code: Select all

cd /usr/local/nagiosxi/scripts
Before executing:

Code: Select all

./repair_databases.sh
Some of the XI scripts are funny and need to be run from the directory, not just called by name.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
kyang

Re: Recurring Database Connection Error

Post 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.
venturegardengroup
Posts: 62
Joined: Tue Jun 28, 2016 10:11 am

Re: Recurring Database Connection Error

Post 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.
kyang

Re: Recurring Database Connection Error

Post 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
venturegardengroup
Posts: 62
Joined: Tue Jun 28, 2016 10:11 am

Re: Recurring Database Connection Error

Post 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 ~]#
dwasswa

Re: Recurring Database Connection Error

Post 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:

Code: Select all

service iptables status


To see if port 80 is open, run:

Code: Select all

iptables -L -n | grep 80


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
venturegardengroup
Posts: 62
Joined: Tue Jun 28, 2016 10:11 am

Re: Recurring Database Connection Error

Post by venturegardengroup »

Hello Dwasswa,

The issue is with the log in is DB error related rather than with the password. See output attached.

Regards,
You do not have the required permissions to view the files attached to this post.
kyang

Re: Recurring Database Connection Error

Post by kyang »

Could you show us your mysql logs?

Code: Select all

tail /var/log/mysqld.log
venturegardengroup
Posts: 62
Joined: Tue Jun 28, 2016 10:11 am

Re: Recurring Database Connection Error

Post 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,
You do not have the required permissions to view the files attached to this post.
Locked