Reputation: 363
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.
Upvotes: 9
Views: 79015
Reputation: 1200
Probably will help to someone.
In my case problem was in typo.
I created file /etc/nrpe.d/commands.cgf
instead of /etc/nrpe.d/commands.cfg
;)
Upvotes: 0
Reputation: 11
Hi i got this error and was able to solve it : in /etc/nagios/nrpe.cfg youll 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 im sure you got confiused and set : commend.cfg with : check_disk and not check_slash
see that the line says " command[check_slash] " this is what the command.cfg wants to get.
Upvotes: 1
Reputation: 91
I have solved this by adding the below lines to my nrpe.cfg
file and restarting the nrpe
. Basically, we are telling to nagios to recognize the commands that we are running.
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$
Upvotes: 1
Reputation: 6305
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 services.cfg
file (or whatever it's name) check 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 it solved your issue.
Upvotes: 3
Reputation: 31
Hello i solved this problem by adding the local address in the configuration file so nrpe.cfg
allowed_host = 127.0.0.1
, xxxx
where xxxx
is the IP of my nagios server.
You should also be defined command [check_disk]=/usr/lib/nagios/plugins/check_disk-w 20%-c 10%-p /var
is very important that the command name [check_disk]
is the same as that indicated on the route
Thanks to this, my problem was solved and I now have an excellent monitoring.
Yilmar Hernández
Upvotes: 3
Reputation: 130
I had a similar problem and checking in syslog I could see that nrpe had 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 quiet 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.
Upvotes: 0
Reputation: 106
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.
Upvotes: 3
Reputation: 1482
Upvotes: 1
Reputation: 246
Did you start NRPE daemon with the correct config file? (nrpe -c config_file -d) The config file you are using there is nagios_local.conf or nrpe_local.cfg?
Upvotes: 1