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 have installed Nagios® Core™ 3.5.1 and NRPE v2.14 on my client which running RHEL 6.3

I have this error message on my Nagios

NRPE: Command 'check_mysql_connections' not defined

On my nrpe.cfg I already set up the allowed_host, include_dir:

allowed_hosts=xx.xx.xx.xx
dont_blame_nrpe=1
include_dir=/etc/nagios/services

my command is on /etc/nagios/services/check_mysql_connections.cfg

command[check_mysql_connections]=/usr/lib64/nagios/plugins/check_mysql_all -K connections -H myHOST -u myUSERNAME -p myPASSWORD

On Nagios Server, I already set up the nagios.cfg file, and add the commands-custom.cfg on /etc/nagios/objects which contains like this:

define command {
command_name    check_mysql_connections
command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mysql_connections
}

and on /etc/nagios/servers I have add the mysql.cfg

## Define Host Group ##

define hostgroup {
hostgroup_name          mysql-databases
alias                   MySQL Databases
}

#######################
## Define Hosts ##

define host {
use             linux-server
host_name       bdgbnbpmydb02
alias           MySQL Database
address         xx.xx.xx.xx
hostgroups      mysql-databases
contact_groups  admins
check_command   check-host-alive
}

#######################
## Define Service ##

define service {
use                     generic-service
hostgroup_name          mysql-databases
service_description     MySQL Connections
check_command           check_mysql_connections
}

I already kill the NRPE process, removing /var/run/nrpe.pid, and start the NRPE process again. And also my NRPE is NOT running under xinet.d

When I try to execute the command locally on the remote host, it gives result. And when I try to execute from the nagios server using this command:

/usr/lib64/nagios/plugins/check_nrpe -H xx.xx.xx.xx -c check_mysql_connections

it also gives result. I don't know what went wrong, because all of my other commands running normally.

share|improve this question
    
When you run the command manually from your Nagios server, are you root user or nagios user ? –  krisFR Dec 21 '13 at 10:25
    
It's an aside, but: bdgbnbpmydb02? What a hostname! See also serverfault.com/questions/479945/… . –  MadHatter Dec 21 '13 at 11:46
    
Sorry to belabour the obvious, but - since you are kind enough to confirm you've restarted NRPE on the client - have you also restarted the NAGIOS server since your last edit to the config files? –  MadHatter Dec 21 '13 at 11:47
    
I'd say "check SELinux", but you'd be getting different error messages if that were interfering with the plugin. I assume that nrpe is running as the "nrpe" user; what does ls -ldZ /etc/nagios/services /etc/nagios/services/check_mysql_connections.cfg show? –  asciiphil Dec 21 '13 at 13:38
    
How did you install NRPE? EPEL? Repoforge? Compiled? –  Keith Dec 21 '13 at 16:11

2 Answers 2

Start at one end and work your way back.

  • You said "/usr/lib64/nagios/plugins/check_mysql_all -K connections -H myHOST -u myUSERNAME -p myPASSWORD" works on the command line.
  • You said that NRPE works on that server with other commands.
  • You said that the command fails on the command line from the nagios server.

This suggests to me that the problem is in the definition on the NRPE server. Is it possible that your obfuscated variables for myHOST, myUSERNAME, or myPASSWORD contain a character that is interpreted non-literally by NRPE? (I'm assuming you've already checked for typos and duplicate definitions!)

share|improve this answer
    
All command both success from Nagios server and client. And no, all of myHOST,myUSERNAME, & myPASSWORD, do not contain strange character, all pure alphabetical characters. –  buzzing_bee Dec 27 '13 at 9:53
    
Oh, I'm sorry. I must have misread. :( Check for duplicate command definitions on the Nagios server itself. They may be hidden in /etc/nrpe. –  Katherine Villyard Dec 27 '13 at 15:15
    
I am sure there is no duplicate command definitions, since I've done installing nagios and nrpe, and I create it myself...maybe i just have to reinstall both nagios and nrpe?? –  buzzing_bee Dec 28 '13 at 1:46
    
They're working for the other plugins. I assume you've already looked in /var/log/messages and /var/log/nagios3/nagios.log or the equivalent on your system... –  Katherine Villyard Dec 28 '13 at 3:14

Normally, I would suspect a permissions problem with that plugin. Be sure to run your manual tests as the nagios (or nrpe) user.

But in this case, it's claiming the NRPE command isn't even defined, so it's not even getting as far as running it...

Put the NRPE command def directly into nrpe.cfg, not in an included file. (And then restart NRPE.)

I recall having a similar problem (but with the NRPE from EPEL), a few years ago, where it wouldn't include another file in nrpe.cfg for some reason. I never did figure out why the include file didn't work, though.

share|improve this answer
    
i've done that, and it's just the same, i put command definition to /etc/nagios/nrpe.cfg and it got the same error –  buzzing_bee Dec 28 '13 at 1:44
    
Then either you're looking at the wrong box, or the NRPE daemon isn't using that config file. –  Keith Dec 29 '13 at 16:56

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.