Client Side:
I have the following location and permissions for this file:
Code: Select all
[root@management ~]# ls -l /usr/lib64/nagios/plugins/check_mem
-rwxr-xr-x. 1 root root 12330 Jul 7 18:21 /usr/lib64/nagios/plugins/check_mem
Code: Select all
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=Nagios monitor server IP
dont_blame_nrpe=1
command[check_drive]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda
command[check_memory]=/usr/lib64/nagios/plugins/check_mem -f -w 30 -c 10
Code: Select all
Allowing connections from: xx.xx.xx.xx
Jul 8 14:37:16 api nrpe[1835]: Connection from xx.xx.xx.xx port 5784
Jul 8 14:37:16 api nrpe[1835]: Host address is in allowed_hosts
Jul 8 14:37:16 api nrpe[1835]: Handling the connection...
Jul 8 14:37:16 api nrpe[1835]: Host is asking for command 'check_memory' to be run...
Jul 8 14:37:16 api nrpe[1835]: Running command: /usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10
Jul 8 14:37:16 api nrpe[1835]: Command completed with return code 3 and output:
Jul 8 14:37:16 api nrpe[1835]: Return Code: 3, Output: NRPE: Unable to read output
Jul 8 14:37:16 api nrpe[1835]: Connection from pÃ}<9c>ÿ#177 closed.
I can run any command from the server to client for ex. "/usr/lib64/nagios/plugins/check_nrpe -H client ip -c check_drive" and gives the expected response.
I've added the following to the command.cfg & the server.cfg, which works great.
Code: Select all
define command{
command_name check_space
command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c check_drive
}
Code: Select all
define service{
use generic-service
host_name api-webserver
service_description Root Partition
check_command check_space
}
Code: Select all
define command{
command_name check_memori
command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c check_memory
}
define service{
use generic-service
host_name api-webserver
service_description Memory
check_command check_memori
}
Code: Select all
[root@api ~]# /usr/lib64/nagios/plugins/check_mem -f -w 20 -c 5
OK - 84.2% (6785808 kB) free.|TOTAL=8059740KB;;;; USED=1273932KB;6447792;7656753;; FREE=6785808KB;;;; CACHES=1024644KB;;;;
Code: Select all
[root@management ~]# /usr/lib64/nagios/plugins/check_nrpe -H 192.168.0.19 -c check_drive
DISK OK - free space: / 11463 MB (86% inode=94%);| /=1716MB;11113;12502;0;13892
[root@management ~]/usr/lib64/nagios/plugins/check_nrpe -H 192.168.0.19 -c check_memory
NRPE: Unable to read output