How to configure MySQL password for check_mysql via NRPE?

Grothaus, Christoph C.Grothaus at LRworld.com
Fri Sep 23 15:35:19 CEST 2011


Hello nagios-users!

I inherited a Linux box (latest Debian stable, aka "Squeeze") with a MySQL database and a Nagios NRPE. Now I'd like to check MySQL status with NRPE. I configured /etc/nagios/nrpe_local.cfg with the following line:

command[check_mysql]=/usr/lib/nagios/plugins/check_mysql

so that this command is available to NRPE. Then I configured the following check on my separate Nagios server:

define service{
        use                     web-check-alert           # use some template configuration
        host_name               ...                       # check my MySQL host
        check_command           check_nrpe!-c check_mysql # check the MySQL via command "check_mysql"
}

Sadly, I get a critical alert for this service with the following message:

Access denied for user nagios at localhost (using password: NO)

The NRPE daemon runs under user "nagios" -- as you might have guessed. According to /etc/passwd, the login shell for this user is /bin/false, and the home directory is /var/lib/nagios. I tried to add a file .my.cnf there:

root at myhost:~# ls -la /var/lib/nagios/.my.cnf
-rw------- 1 nagios nagios 40 21. Sep 17:37 /var/lib/nagios/.my.cnf

This file contains the necessary bits to connect to the local MySQL database. The login information are correct, I checked exactly the same file with my user account on the server. So, this file seems not to be picked up.

I am lost here. What am I doing wrong? How must I configure Nagios/NRPE to get a working connection to the MySQL database?

Any help appreciated.


Regards,

Christoph Grothaus
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list