Database Connection Error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Re: Database Connection Error

Post by grenley »

Plan B?

Code: Select all

Failed to retrieve zip file!
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Re: Database Connection Error

Post by grenley »

As I said on my previous post, I cannot download the profile.zip file.
It fails.
Any other suggestions?

BTW, since the hard reboot, I see the following messages in nagios.log:

Code: Select all

[1424334094] ndomod: Error writing to data sink!  Some output may get lost...
[1424334094] ndomod: Please check remote ndo2db log, database connection or SSL Parameters

Feb 19 08:22:34 zltc5114 ndo2db: Error: Could not connect to MySQL database: Too many connections
I'm thinking this is a related issue
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Database Connection Error

Post by abrist »

Let try increasing the max_connections for mysql. Edit /etc/my.cnf and add the following to [mysqld] section:

Code: Select all

 set-variable=max_connections=500
Restart mysql:

Code: Select all

service mysqld restart
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Re: Database Connection Error

Post by grenley »

I have no /etc/my.cnf
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Database Connection Error

Post by lmiltchev »

I have no /etc/my.cnf
You have some non-standard paths. It may be in a different location... Can you find it at all?

Code: Select all

find / -name my.cnf
Be sure to check out our Knowledgebase for helpful articles and solutions!
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Re: Database Connection Error

Post by grenley »

Duh. I thought I had done that, but was in the wrong window. Sorry.
Yes. it's in an alternate path.
my.cnf contains the following entry in the [mysqld] section

Code: Select all

max_connections = 1000
you sure you want me to change it to 500?

As for the "official ticket" route, any idea why I get an error when I try to do the profile.zip download?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Database Connection Error

Post by scottwilkerson »

looking at the log you posted the other day it looks like some other setting is getting pulled in, setting the max_connections to 214

Code: Select all

150218 16:32:30 mysqld_safe mysqld from pid file //opt/app/mysql/data/zltc5114.pid ended
150218 16:32:54 mysqld_safe Starting mysqld daemon with databases from //opt/app/mysql/data
150218 16:32:54 [Warning] Changed limits: max_open_files: 1024  max_connections: 214  table_cache: 400
Are we sure we are in the correct config file? On the correct server?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Database Connection Error

Post by tgriep »

Can you post your ndo2db.cfg file?
The file is in this folder by default.
/usr/local/nagios/etc
FYI, there are passwords in it so you may want to change them.

One question I have, is the MYSQL server on the Nagios XI server or is it on another server?
Be sure to check out our Knowledgebase for helpful articles and solutions!
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Re: Database Connection Error

Post by grenley »

Here's my ndo2db.cfg:

Code: Select all

#####################################################################
# NDO2DB DAEMON CONFIG FILE
#####################################################################


lock_file=/opt/app/nagios/var/ndo2db.lock

ndo2db_user=nagios
ndo2db_group=nagios

socket_type=unix

socket_name=/opt/app/nagios/var/ndo.sock

tcp_port=5668


db_servertype=mysql
db_host=localhost
db_port=3306

db_name=nagios
db_prefix=nagios_

db_user=ndoutils
db_pass=n@gweb

db_socket=/opt/app/mysql/mysql.sock

## TABLE TRIMMING OPTIONS
# Several database tables containing Nagios event data can become quite large
# over time.  Most admins will want to trim these tables and keep only a
# certain amount of data in them.  The options below are used to specify the
# age (in MINUTES) that data should be allowd to remain in various tables
# before it is deleted.  Using a value of zero (0) for any value means that
# that particular table should NOT be automatically trimmed.

# Keep timed events for 24 hours
max_systemcommands_age=10080

# Keep service checks for 1 week
max_servicechecks_age=10080

# Keep host checks for 1 week
max_hostchecks_age=10080

# Keep event handlers for 31 days
max_eventhandlers_age=44640





# DEBUG LEVEL
# This option determines how much (if any) debugging information will
# be written to the debug file.  OR values together to log multiple
# types of information.
# Values: -1 = Everything
#          0 = Nothing
#          1 = Process info
#          2 = SQL queries

debug_level=0



# DEBUG VERBOSITY
# This option determines how verbose the debug log out will be.
# Values: 0 = Brief output
#         1 = More detailed
#         2 = Very detailed

debug_verbosity=1

# DEBUG FILE
# This option determines where the daemon should write debugging information.

debug_file=/opt/app/nagios/var/ndo2db.debug



# MAX DEBUG FILE SIZE
# This option determines the maximum size (in bytes) of the debug file.  If
# the file grows larger than this size, it will be renamed with a .old
# extension.  If a file already exists with a .old extension it will
# automatically be deleted.  This helps ensure your disk space usage doesn't
# get out of control when debugging.

max_debug_file_size=1000000
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Re: Database Connection Error

Post by grenley »

with respect to whether we are using the same my.cnf as I posted.
Yes.

Code: Select all

max_connections = 1000
Also, remember, this was working before the reboot and we've made no configuration changes.
Locked