Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 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).

share|improve this answer
up vote 0 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.