1

I'm attempting to test out the check_mysql plugin for Nagios using the command line. It works great when I'm just checking localhost but when I try to specify a different server (using the -H argument) I keep getting the following error message:

CRITICAL - Unable to connect to mysql://nagios_user@{remoteServerHostname}/ - Access denied for user 'nagios_user'@'{localServerHostName}' (using password: YES)

It looks like it's trying to connect to the database using the localhost server even though I've specified a different host name. I've already set up this user on the remote database and they have correct permissions. I'm just trying to figure out why the script keeps inserting the localhost server name instead of the remote one.

2 Answers 2

2

The default setting for a MySQL server is to deny access from clients with IP addresses other than the server address. To get around this, run the following command on your server:

# mysql -u root mysql> grant select on [DB name you're checking].* to 'nagios_user'@'[Nagios server IP address or hostname]' identified by '[password for nagios_user]'; mysql> flush privileges; 

Also check that your MySQL server's firewall allows access from your Nagios server on the MySQL server port (default is 3306).

0

I ended up using NRPE with a plugin which solved my connection issue.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.