Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nagios NRPE: Command not defined

Tags:

nagios

nrpe

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.

like image 819
Sandeep Avatar asked Dec 10 '12 04:12

Sandeep


People also ask

What is Nrpe in Nagios?

NRPE. Nagios Remote Plugin Executor (NRPE) is a Nagios agent that allows remote system monitoring using scripts that are hosted on the remote systems. It allows for monitoring of resources such as disk usage, system load or the number of users currently logged in.

How do I start Nrpe daemon on Linux?

To do this, we need check_nrpe plugin. We can install bunch of Nagios plugins including check_nrpe plugin using the following command. These plugins will be installed to /usr/lib/nagios/plugins. If you see NRPE version as the command output, that means you have successfully configured NREP daemon on the remote host.


1 Answers

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.

like image 143
Horaasje Avatar answered Oct 04 '22 01:10

Horaasje