Page 1 of 2

NRPE checks do not work for Linux hosts

Posted: Mon Nov 23, 2015 6:51 am
by dlukinski
Hello XI Support

We started developing NRPE checks against Linux systems.
So far no success with any of them.

Currently using test CentOS 6.7 host with client installed (from XI documentation).
Getting "CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages" at best

Please help to make this work as we are planning to NRPE check applications.

Re: NRPE checks do not work for Linux hosts

Posted: Mon Nov 23, 2015 8:04 am
by dlukinski
dlukinski wrote:Hello XI Support

We started developing NRPE checks against Linux systems.
So far no success with any of them.

Currently using test CentOS 6.7 host with client installed (from XI documentation).
Getting "CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages" at best

Please help to make this work as we are planning to NRPE check applications.
dont_blame_nrpe=1 already

Re: NRPE checks do not work for Linux hosts

Posted: Mon Nov 23, 2015 10:26 am
by lmiltchev
How did you install the Linux agent (NRPE + Nagios Plugins)? Did you follow this guide?

Run the following commands and show the output:

On the client (remote machine):

Code: Select all

uname -a
cat /etc/*release
ip addr
find / -name nrpe
ps axuw | grep nrpe
netstat -at | grep nrpe
On the Nagios XI server:

Code: Select all

nmap <client ip> -p 5666
/usr/local/nagios/libexec/check_nrpe -H <client ip>
Also, show the actual check that you are running from the command line along with the output of it, and the command definition on the client. Example:

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
/usr/local/nagios/libexec/check_nrpe -H 192.168.x.x -p 5666 -c check_users -a '-w 2 -c 5'
USERS OK - 1 users currently logged in |users=1;2;5;0

Re: NRPE checks do not work for Linux hosts

Posted: Tue Nov 24, 2015 12:16 pm
by dlukinski
lmiltchev wrote:How did you install the Linux agent (NRPE + Nagios Plugins)? Did you follow this guide?

Run the following commands and show the output:

On the client (remote machine):

Code: Select all

uname -a
cat /etc/*release
ip addr
find / -name nrpe
ps axuw | grep nrpe
netstat -at | grep nrpe
On the Nagios XI server:

Code: Select all

nmap <client ip> -p 5666
/usr/local/nagios/libexec/check_nrpe -H <client ip>
Also, show the actual check that you are running from the command line along with the output of it, and the command definition on the client. Example:

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
/usr/local/nagios/libexec/check_nrpe -H 192.168.x.x -p 5666 -c check_users -a '-w 2 -c 5'
USERS OK - 1 users currently logged in |users=1;2;5;0

1. Yes I followed your guide (provided by you in response to me other post)

2. Client output:
login as: root
[email protected]'s password:
Last login: Wed Nov 11 12:54:30 2015
[root@cakc-nfs01 ~]# uname -a
Linux cakc-nfs01 2.6.32-573.8.1.el6.x86_64 #1 SMP Tue Nov 10 18:01:38 UTC 2015 x 86_64 x86_64 x86_64 GNU/Linux
[root@cakc-nfs01 ~]# cat /etc/*release
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
[root@cakc-nfs01 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:2b:cd:48 brd ff:ff:ff:ff:ff:ff
inet 10.x.x.x/24 brd 10.x.0.255 scope global eth0
inet6 fe80::20c:29ff:fe2b:cd48/64 scope link
valid_lft forever preferred_lft forever
[root@cakc-nfs01 ~]# find / -name nrpe
/tmp/linux-nrpe-agent/subcomponents/nrpe
/tmp/linux-nrpe-agent/subcomponents/nrpe/mods/cfg/nrpe
/tmp/linux-nrpe-agent/subcomponents/nrpe/nrpe-2.15/src/nrpe
/tmp/linux-nrpe-agent/subcomponents/nrpe/nrpe-2.15/package/solaris/pkg/nrpe
/usr/local/nagios/bin/nrpe
/usr/local/nagios/etc/nrpe
/etc/xinetd.d/nrpe
[root@cakc-nfs01 ~]# ps axuw | grep nrpe
root 14835 0.0 0.0 103304 892 pts/1 S+ 12:03 0:00 grep nrpe
[root@cakc-nfs01 ~]#


3. Server output

login as: root
[email protected]'s password:
Last login: Tue Nov 24 12:07:16 2015
[root@fikc-nagxidev01 ~]# nmap 10.x.x.91 -p 5666

Starting Nmap 6.47 ( http://nmap.org ) at 2015-11-24 12:15 EST
Nmap scan report for 10.67.0.91
Host is up (0.14s latency).
PORT STATE SERVICE
5666/tcp open nrpe

Nmap done: 1 IP address (1 host up) scanned in 0.38 seconds
You have new mail in /var/spool/mail/root
[root@fikc-nagxidev01 ~]# /usr/local/nagios/libexec/check_nrpe -H 10.x.x.91
NRPE v2.15
[root@fikc-nagxidev01 ~]#


COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.67.0.91 -t 30 -c Check_OS_Version -a show-all 'detail-syntax=\$\{kernel_name\} Version \$\{kernel_release\}'
OUTPUT: CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

Maybe I do not understand relationships in between NRPE and plugins?

Re: NRPE checks do not work for Linux hosts

Posted: Tue Nov 24, 2015 12:25 pm
by hsmith
Can we see the contents of /usr/local/nagios/etc/nrpe.cfg on your remote machine? The .91 one.

Re: NRPE checks do not work for Linux hosts

Posted: Tue Nov 24, 2015 12:52 pm
by dlukinski
hsmith wrote:Can we see the contents of /usr/local/nagios/etc/nrpe.cfg on your remote machine? The .91 one.
Attached the file

Re: NRPE checks do not work for Linux hosts

Posted: Tue Nov 24, 2015 1:08 pm
by hsmith
Is Check_OS_Version something you set up? What is inside of /usr/local/nagios/etc/nrpe/common.cfg on your system?

Mine for example:

Code: Select all

cat common.cfg

### 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$[

Re: NRPE checks do not work for Linux hosts

Posted: Tue Nov 24, 2015 2:44 pm
by gormank
To the OP,
I looked at nrpe.cfg.txt and see some extra newlines.
Check_OS_Version above is a command that would be defined in nrpe.cfg, not a script/binary that NRPE will execute. There's a bit of abstraction going on--same with commands on Windows.
Try using a command already defined and not commented in nrpe.cfg and run it.

Note that the command example check_cpu_stats runs the script check_cpu_stats.sh at the path shown. Command names and the script/executable names don't have to match though.

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$

NRPE is told to run the command, and it uses the entry in nrpe.cfg to run the script. Finally, the script has to be on the host you're monitoring.

Re: NRPE checks do not work for Linux hosts

Posted: Tue Nov 24, 2015 3:11 pm
by dlukinski
gormank wrote:To the OP,
I looked at nrpe.cfg.txt and see some extra newlines.
Check_OS_Version above is a command that would be defined in nrpe.cfg, not a script/binary that NRPE will execute. There's a bit of abstraction going on--same with commands on Windows.
Try using a command already defined and not commented in nrpe.cfg and run it.

Note that the command example check_cpu_stats runs the script check_cpu_stats.sh at the path shown. Command names and the script/executable names don't have to match though.

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$

NRPE is told to run the command, and it uses the entry in nrpe.cfg to run the script. Finally, the script has to be on the host you're monitoring.
Thank you!
- did not realize some commands would be commented

How do I know which of them are safe to uncomment and why they are commented in first place?
- any documentation on this matter?

Re: NRPE checks do not work for Linux hosts

Posted: Tue Nov 24, 2015 3:21 pm
by dlukinski
hsmith wrote:Is Check_OS_Version something you set up? What is inside of /usr/local/nagios/etc/nrpe/common.cfg on your system?

Mine for example:

Code: Select all

cat common.cfg

### 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$[
----------------------------------------------------------------------------------------------------------------------------------

I do not have /usr/local/nagios/etc/npre folder to begin with :-\
- standard XI install 5.2.2