nagios mysqld.pl check fails
Hello,
I'm trying to use the check_mysqld.pl plugin from the exchange. When I run the command from the nagios server on the command line it seems to succeed: Code:
[root@cloud:/usr/local/nagios/etc/objects] #/usr/local/nagios/libexec/check_nrpe -H beta.domain.com -c check_mysqld But in the nagios web interface the check fails with a critical error: Code:
CRITICAL ERROR - Unable to connect to database '' on server 'localhost' on port 3306 with user '' - Access denied for user 'nagios'@'localhost' (using password: NO) Code:
[nagios@beta ~]$ /usr/local/nagios/libexec/check_mysqld.pl In the command definition I did allow space for the username and password just in case I had a problem implementing it remotely: Code:
# 'check_mysqld' command definition My service definition was pretty straight forward: Code:
# Define a service to check MYSQL on the local machine.define service{ In my nrpe command definition on the client, this is what I have: Code:
command[check_mysqld]=/usr/local/nagios/libexec/check_mysqld.pl -u root -p secret |
The error is telling you the reason it failed is because it was looking for the MySQL database on localhost which would be your Nagios master but your command line makes it clear you want to check for it on a remote host. (beta.domain.com = remote host and presumably cloud = nagios master).
localhost always = 127.0.0.1 and always means the host on which you presently are on. When you run check_mysql.pl and don't specify a host from your Nagios master then it is trying to check your master and NOT beta.domain.com. You're using the wrong command in services.cfg (or commands.cfg). Your command line used check_nrpe rather than check_mysqld. That is to say you are not doing the same check from command line that you have defined in Nagios services.cfg and commands.cfg. You should either modify your services.cfg command to do the same check_nrpe you did from command line OR modify your check_mysqld in commands.cfg so it does the check_nrpe you did from command line (or modify it so it does check_mysql.pl but allows specification of a remote host). check_nrpe expects you to ask the remote host's nrpe daemon to run whatever is defined in the remote host's nrpe.cfg for the specified command. check_mysql.pl however is a completely separate plugin so you can either check it with check_nrpe if defined in nrpe.cfg on the remote host (as you did from command line) or use check_mysql.pl itself without going through the check_nrpe/nrpe configuration at all. Either way is valid. One reason you might choose to do check_nrpe instead of check_mysql.pl is to avoid having to open up the database on your remote host to external connections. Here we tend to do DB checks using the remote DB check rather than check_nrpe and use check_nrpe mainly for things we define locally on each host (e.g. memory checks, cpu checks, process checks). |
All times are GMT -5. The time now is 04:29 AM. |