Nagios and mysql


#1

Hello all

I recently took over a Nagios install and have some questions. I would like to pull some info out of mysql but having problems loging in. I can login to mysql with root but get permission denied when I attempt to use the nagios databases? Any help would be greatly appreciated.

Thanks,
Duner


#2

su - nagios
mysql

:wink:

The Nagios user must have access to it’s DB :slight_smile:

Luca


#3

Thanks Luca!

One more question?? The admin that left did not give me the password for user account nagios. :cry: If I change the passord, what must I change in Nagios to see the change?

Sorry somewhat unformiliar with Nagios.

Thanks for all your help.

Duner


#4

nagios.sourceforge.net/docs/1_0/ … tml#config


#5

I thought it may have something to do with the cgi and resource file, but all the lines are commented out.

#xdddb_host=somehost
#xdddb_port=someport
#xdddb_database=somedatabase
#xdddb_username=someuser
#xdddb_password=somepassword


#6

Are you sure nagios is actually using mysql?
in the etc directory try a
grep db_password *
and see if it finds some other file where the password could be stored.

Luca


#7

Here are the results.
grep db_password *
cgi.cfg:#xeddb_password=somepassword
cgi.cfg:#xsddb_password=somepassword
cgi.cfg:#xcddb_password=somepassword
cgi.cfg:#xdddb_password=somepassword
cgi.cfg-sample:#xeddb_password=somepassword
cgi.cfg-sample:#xsddb_password=somepassword
cgi.cfg-sample:#xcddb_password=somepassword
cgi.cfg-sample:#xdddb_password=somepassword
resource.cfg:#xsddb_password=somepassword
resource.cfg:#xcddb_password=somepassword
resource.cfg:#xdddb_password=somepassword
resource.cfg:#xrddb_password=somepassword
resource.cfg-sample:#xsddb_password=somepassword
resource.cfg-sample:#xcddb_password=somepassword
resource.cfg-sample:#xdddb_password=somepassword
resource.cfg-sample:#xrddb_password=somepassword

Its possible it is on a different DB. How can I find out. I didn’t think there were many choices when it can to DB’s.


#8

It sounds to me that you don’t even use mysql with nagios at all. Which makes sense now, since root would have access to all databases and you stated that “I can login to mysql with root but get permission denied when I attempt to use the nagios databases”. Most likely there is no nagios db at all.


#9

if you don’t need mysql running or can stop it for a couple of minutes… stop nagios, stop mysql and restart nagios and see if it gives any errors… as Jakkedup said it looks like you aren’t using mysql at all. :slight_smile:

Luca


#10

true dat luca.
You could also login to the mysql and take a look again.
su - root
mysql -p
enter your password for user root
then execute this mysql command:
show databases;
it will show you all of the db on your system.
I’d like to see that output please. I bet nagios is not even in that list.


#11

Here is the DB list.
show databases;
±-------------+
| Database |
±-------------+
| ContactDB |
| Img |
| JobsDB |
| LocDB |
| MenuDB |
| bugs |
| employees |
| mysql |
| poe_sessions |
| points |
| test |
±-------------+
Not to ask a stupid question but does Nagios need a DB? If not were is the data stored?

Thank you so much for all your help.


#12

no it doesn’t need a DB, in fact the latest version doesn’t even give the oportunity to use it.
It stores everything in files.

Well now we know your nagios isn’t using a DB :slight_smile:

Luca


#13

nagios.sourceforge.net/docs/1_0/xdata-db.html