Nagios NRPE: command not defined

The following command has nrpe_local.cfg added to my nrpe_local.cfg :

 command[check_mycommand]=/usr/lib/nagios/plugins/check_command 30 35 

and then restart the nrpe daemon.

When I execute this command with nrpe , I get the following error:

 NRPE: Command 'check_mycommand' not defined 

I used the following command to execute:

 /usr/lib/nagios/plugins/check_nrpe -H hostname -c check_mycommand 

I can not understand.

10 more commands have been added to my nrpe_local.cfg and they work correctly.

+6
source share
8 answers

Hello, I solved this problem by adding a local address to the configuration file so that nrpe.cfg allowed_host = 127.0.0.1 , xxxx where xxxx is the IP of my nagios server. You must also be defined with the command [check_disk]=/usr/lib/nagios/plugins/check_disk-w 20%-c 10%-p /var

it is very important that the command name [check_disk] is the same as indicated on the route

Thanks to this, my problem was resolved, and now I have excellent monitoring.

Yilmar Hernandez

+3
source

Your command in nrpe.cfg should look like this:

 command[check_mycommand]=/usr/lib/nagios/plugins/check_command -w $ARG1$ -c $ARG2$ 

then your service in the services.cfg file (or whatever it is called there) should look like this:

 define service{ servicegroups Basic Functionality host_name localhost service_description Mycommand check_command check_nrpe!check_mycommand -a '-w 30 -c 35' use generic-service } 

Please let me know if he solves your problem.

+3
source

The following command has been added to my nrpe_local.cfg:> command[check_mycommand]=/usr/lib/nagios/plugins/check_command 30 35

Try:

 command[check_mycommand]=/usr/lib/nagios/plugins/check_command -w (warningTreshold) -c (criticalTreshold) /etc/init.d/nagios-nrpe-server restart 

Indeed, kill all other nrpe daemons that are already running. The reason may be that it is already running by different users, which can cause conflicts. eg. nagios-nrpe-server runs as root and as nagios

Also make sure you add the IP address of the Nagios server to the allowed_hosts in the /etc/nagios/nrpe.cfg file:

 allowed_hosts=<ip address of nagios server> 

Otherwise, you will not be able to execute external commands using NRPE from Nagios.

+2
source

Did the NRPE daemon run the correct configuration file? (nrpe -c config_file -d) The configuration file you are using is nagios_local.conf or nrpe_local.cfg?

+1
source
  • Make sure you kill all the old demons, including any forks.
  • After a clean NRPE restart, check / var / log / messages for errors! Especially things like "NRPE: ERROR - cannot communicate with a port / port that is already in use."
  • Are you sure NRPE managed by inetd is not used?
  • If the above does not help, repeat step 1, then when starting NRPE do not enable the '-d' flag and do not check the output.
+1
source

I solved this by adding the lines below to my nrpe.cfg file and restarting nrpe . Basically, we say nagios to recognize the commands that we run.

 command[check_var]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /var command[check_slash]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p / command[check_ssh]=/usr/lib64/nagios/plugins/check_ssh $ARG1$ 
+1
source

Hi, I got this error and was able to solve it: in /etc/nagios/nrpe.cfg you will see:

 command[check_var]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /var command[check_slash]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p / command[check_ssh]=/usr/lib64/nagios/plugins/check_ssh $ARG1$ 

but I am sure that you took possession and put: commend.cfg with: check_disk, not check_slash

see that the line says “command [check_slash]”, this is what command.cfg wants to get.

+1
source

I had a similar problem and check in syslog. I saw nrpe running into write problems in / var / run /

 Nov 6 08:30:05 xxxxxx nrpe[39777]: Cannot write to pidfile '/var/run/nrpe.pid' - check your privileges. 

I found here:

https://bugs.launchpad.net/ubuntu/+source/nagios-nrpe/+bug/957367

that the solution was pretty simple. Just edit nrpe.cfg and change:

 pid_file=/var/run/nrpe.pid 

to

 pid_file=/var/run/nagios/nrpe.pid 

kill nrpe manually and start it again with /etc/init.d/nagios-nrpe-server start

It just worked for me.

0
source

All Articles