Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 06-16-2012, 09:17 PM   #1
Registered: Jun 2003
Location: Summit, NJ
Distribution: CentOS 5.4
Posts: 124

Rep: Reputation: 15
Post nagios check fails


I'm trying to use the plugin from the exchange.

When I run the command from the nagios server on the command line it seems to succeed:

[root@cloud:/usr/local/nagios/etc/objects] #/usr/local/nagios/libexec/check_nrpe -H -c check_mysqld
MYSQL 5.5.23 OK

But in the nagios web interface the check fails with a critical error:

CRITICAL ERROR - Unable to connect to database '' on server 'localhost' on port 3306 with user '' - Access denied for user 'nagios'@'localhost' (using password: NO)
If I run the plugin on the client end as the nagios user this is what the run looks like:

 [nagios@beta ~]$ /usr/local/nagios/libexec/
 MYSQL 5.5.23 OK

In the command definition I did allow space for the username and password just in case I had a problem implementing it remotely:

# 'check_mysqld' command definition
define command{
        command_name    check_mysqld
      command_line    $USER1$/ -u $ARG1$ -p $ARG2$

My service definition was pretty straight forward:

# Define a service to check MYSQL on the local machine.define service{
        use                             local-service
        host_name                       beta
        service_description             MYSQL
        check_command                   check_mysqld
        notifications_enabled           0
(leaving notifications disabled until I sort this out)

In my nrpe command definition on the client, this is what I have:

command[check_mysqld]=/usr/local/nagios/libexec/ -u root -p secret
So I am wondering why this check fails with the above error in the web interface when it succeeds on the command line as I have shown. Thanks for any input you may have!

Last edited by bluethundr; 06-16-2012 at 09:27 PM. Reason: Averting rudeness
Old 06-18-2012, 07:08 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,407
Blog Entries: 15

Rep: Reputation: 1424Reputation: 1424Reputation: 1424Reputation: 1424Reputation: 1424Reputation: 1424Reputation: 1424Reputation: 1424Reputation: 1424Reputation: 1424
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. ( = remote host and presumably cloud = nagios master).

localhost always = and always means the host on which you presently are on. When you run and don't specify a host from your Nagios master then it is trying to check your master and NOT

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

Last edited by MensaWater; 06-18-2012 at 07:10 AM.


mysql, nagios

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL (mysqld) fails to start! dot_pro Linux - Server 1 09-27-2011 02:56 PM
[RHEL] nagios-plugin install error - C preprocessor "/lib/cpp" fails sanity check samengr Linux - Software 5 11-02-2009 10:04 AM
fails to start syslogd and mysqld after moving /var to new partition jweller Red Hat 8 03-27-2008 02:32 PM
mandriva fails to start /etc/init.d/mysqld johnnysd Linux - Server 4 11-24-2006 11:23 AM
mysqld fails on startup wiseraptor Linux - Newbie 0 02-07-2003 03:42 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:12 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration