Page 1 of 3

NRPE Command Not Defined

Posted: Mon Nov 30, 2015 3:09 pm
by jnoble921
Nagios Core: 4.1.1
NRPE Client Verison: NRPE v2.15
Both server and client have CentOS 7 Core installed

I am not able to add new commands to check my NRPE client. I keep getting NRPE: Command 'check_uptime' not defined
From my Nagios server I am testing this by running /usr/local/nagios/libexec/check_nrpe -H <MY HOST> -c check_uptime

However some commands work like, but only the "hard coded" commands. I enabled dont_blame_nrpe = 1
/usr/local/nagios/libexec/check_nrpe -H <MY HOST>
/usr/local/nagios/libexec/check_nrpe -H <MY HOST> -c check_total_procs
/usr/local/nagios/libexec/check_nrpe -H <MY HOST> -c check_users


The check_total_procs will not let me change the warning or cirtical threshold however.

I think that I have added the command to my client, /usr/local/nagios/etc/nrpe.cfg
command[check_uptime]=/usr/local/nagios/libexec/check_uptime

I do not know if this is of any help but this is the guide that I followed. http://www.tecmint.com/how-to-add-linux ... ng-server/

I am sure that I am missing something simple and that this gets asked a lot but I would really appreciate any help. Please let me know if there is other information that I can provide.

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 3:32 pm
by hsmith
What method did you use to install NRPE?

Code: Select all

find / -name common.cfg -exec cat {} \;

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 3:43 pm
by jnoble921
I found the tutorial at http://www.tecmint.com/how-to-add-linux ... ng-server/, if that is what you mean by method. Please let me know if that is not and I will try and help.

I ran the command you posted on both my server and client. Below is the return on my client. There was no return on my server.

Code: Select all

find / -name common.cfg -exec cat {} \;
find: ‘/run/user/1000/gvfs’: Permission denied

### GENERIC SERVICES ###
command[check_init_service]=sudo /usr/local/nagios/libexec/check_init_service $ARG1$
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$

### MISC SYSTEM METRICS ###
#command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$

### SYSTEM UPDATES ###
command[check_yum]=/usr/local/nagios/libexec/check_yum
command[check_apt]=/usr/local/nagios/libexec/check_apt

### DISK ###
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$

### PROCESSES ###
command[check_all_procs]=/usr/local/nagios/libexec/custom_check_procs
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

### OPEN FILES ###
command[check_open_files]=/usr/local/nagios/libexec/check_open_files.pl $ARG1$

### NETWORK CONNECTIONS ###
command[check_netstat]=/usr/local/nagios/libexec/check_netstat.pl -p $ARG1$ $ARG2$
### GENERIC SERVICES ###
command[check_init_service]=sudo /usr/local/nagios/libexec/check_init_service $ARG1$
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$

### MISC SYSTEM METRICS ###
#command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$

### SYSTEM UPDATES ###
command[check_yum]=/usr/local/nagios/libexec/check_yum
command[check_apt]=/usr/local/nagios/libexec/check_apt

### DISK ###
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$

### PROCESSES ###
command[check_all_procs]=/usr/local/nagios/libexec/custom_check_procs
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

### OPEN FILES ###
command[check_open_files]=/usr/local/nagios/libexec/check_open_files.pl $ARG1$

### NETWORK CONNECTIONS ###
command[check_netstat]=/usr/local/nagios/libexec/check_netstat.pl -p $ARG1$ $ARG2$
Thank you so much for replying!

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 3:49 pm
by hsmith
Server should not have had an output, so that is good. Can you try some of the commands listed in that common.cfg and see if they work?

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 3:56 pm
by jnoble921
hsmith wrote:Server should not have had an output, so that is good. Can you try some of the commands listed in that common.cfg and see if they work?
I am sorry, I am not sure what you mean. If I run those commands from my client they seem to work fine like, /usr/local/nagios/libexec/check_yum, OS is up to date. check_uptime etc

However once I check them from server that is where the issue appears to be.

Please let me know what I can do to help more diagnose this! Thank you so much.

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 4:01 pm
by hsmith
From the server, if you run /usr/local/nagios/libexec/check_nrpe -H <your host> -c check_yum for example, does it return anything?

How about this scenario? su to the nagios user, and try to run the plugin locally.

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 4:11 pm
by jnoble921
hsmith wrote:From the server, if you run /usr/local/nagios/libexec/check_nrpe -H <your host> -c check_yum for example, does it return anything?

How about this scenario? su to the nagios user, and try to run the plugin locally.
From the monitoring server that is running "nagios"

Code: Select all

su nagios
[nagios@nagios /]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.52 -c check_yum
NRPE: Command 'check_yum' not defined
Some stuff does work

Code: Select all

[nagios@nagios /]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.52 -c check_total_procs
PROCS CRITICAL: 215 processes | procs=215;150;200;0;
I am sorry EDIT

From the machine that I want to monitor

Code: Select all

[nagios@localhost jnoble]$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_yum
NRPE: Command 'check_yum' not defined
[nagios@localhost jnoble]$

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 4:17 pm
by hsmith
What are the permissions of /usr/local/nagios/etc/nrpe/common.cfg?

Code: Select all

ls -l /usr/local/nagios/etc/nrpe
edit:

Try this command on the machine you want to monitor

Code: Select all

/usr/local/nagios/libexec/check_yum


Like you did in the previous post. Leave check_nrpe out of it for now, if that makes sense.

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 4:27 pm
by jnoble921
hsmith wrote:What are the permissions of /usr/local/nagios/etc/nrpe/common.cfg?

Code: Select all

ls -l /usr/local/nagios/etc/nrpe
edit:

Try this command on the machine you want to monitor

Code: Select all

/usr/local/nagios/libexec/check_yum


Like you did in the previous post. Leave check_nrpe out of it for now, if that makes sense.

Code: Select all

[[email protected] jnoble]$ ls -l /usr/local/nagios/etc/nrpe
total 8
-rw-r--r--. 1 nagios nagios  687 Nov 16 14:10 asterisk.cfg
-rw-r--r--. 1 nagios nagios 1309 Nov 16 14:10 common.cfg

Code: Select all

[[email protected] jnoble]$ /usr/local/nagios/libexec/check_yum
YUM OK:  O/S is up to date.

192.168.1.52 is the server that I want to monitor
192.168.1.54 OR nagios is my main server
Information that may have been helpful sooner but I wanted to make sure that is clear maybe

Re: NRPE Command Not Defined

Posted: Mon Nov 30, 2015 5:28 pm
by lmiltchev
On the 192.168.1.52 box, run:

Code: Select all

service xinetd restart
On the 192.168.1.54 box, run:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.52 -c check_yum
and show the output.

Also, post the entire nrpe.cfg and common.cfg file.