Nagios NRPE: Command not defined

Sandeep picture Sandeep · Dec 10, 2012 · Viewed 66.6k times · Source

In my nrpe_local.cfg added following command:

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

and then restarted nrpe daemon.

When I execute this command using nrpe I'm getting the following error:

NRPE: Command 'check_mycommand' not defined

I used following command to execute:

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

I am unable to get any clue.

In my nrpe_local.cfg there are 10 more commands added and they are working properly.

Answer

Horaasje picture Horaasje · Apr 30, 2013

In my nrpe_local.cfg added following command:> 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

And indeed kill all other daemons of nrpe which are already running. The cause could be it is already running by different users which may cause conflicts. eg. nagios-nrpe-server is running under user root and under user nagios

Also make sure you added your Nagios server's IP address to the allowed_hosts in /etc/nagios/nrpe.cfg :

allowed_hosts=<ip address of nagios server>

Else you won't be able to execute external commands with NRPE from Nagios.