====== NRPE installation and configuration ======
First install NRPE on the Nagios server and on the client to monitor.
On the client, if you have multiple ethernet adapter specify on which the NRPE demon will LISTEN (server_address=192.168.222.152)
Enable the log in verbose mode to be able to debug, once everything is right that can be changed.\\
Parameters: log_facility=daemon and debug=1
On the client start the nrpe demon
/etc/rc.d/init.d/nrpe start
On the Nagios server try to contact the client:
[root@nagios objects]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.222.152
CHECK_NRPE: Error - Could not complete SSL handshake.
You have to authorize the Nagios server to contact the client. On the client in /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.222.168
Restart you nrpe demon on the client:
/etc/rc.d/init.d/nrpe restart
On the Nagios server try to contact the client:
[root@nagios objects]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.222.152
NRPE v2.15
**Now it work !**
Try another test:
[root@nagios objects]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.222.152 -c check_load
OK - load average: 1.30, 1.35, 1.44|load1=1.300;15.000;30.000;0; load5=1.350;10.000;25.000;0; load15=1.440;5.000;20.000;0;
[root@nagios objects]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.222.152 -c check_total_procs
PROCS OK: 62 processes | procs=62;150;200;0;
Threshold and command are defined on the client into /etc/nagios/nrpe.cfg
...
command[check_users]=/opt/freeware/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/opt/freeware/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/opt/freeware/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/opt/freeware/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/opt/freeware/lib/nagios/plugins/check_procs -w 150 -c 200
Now you can add on the Nagios server into **command.cfg**
# 'check_nrpe_load' command definition
define command{
command_name check_nrpe_load
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_load
}
# 'check_nrpe_procs' command definition
define command{
command_name check_nrpe_procs
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_total_procs
}
And in **services.cfg**
define service{
use aix-service
hostgroup_name aix
service_description CPU Load
check_command check_nrpe_load
}
define service{
use aix-service
hostgroup_name aix
service_description Total Processes
check_command check_nrpe_procs
}
# nagios -v /etc/nagios/nagios.cfg
# /etc/rc.d/init.d/nagios reload
===== Compile NRPE for AIX =====
On AIX binary files or RPM start NRPE as root
To change it, recompile **nrpe.c**
Get latest source from github, and modify using the followin paragraph, starting line 2587 on version 4.1.0
#endif
/* Last Modified: 2022-07-18 line 2587 */
if (full_drop) {
/*setuid(uid) doesn’t work on aix but doesn’t return -1 either*/
if (setuid(uid) == -1)
logit(LOG_ERR, "Warning: Could not set UID=%d", (int)uid);
/*setuid(uid) returned anything but -1*/
else
/*if the current uid still isn’t geteuid() setuid failed and thus we SETEUID(uid)*/
if (uid != geteuid())
if (SETEUID(uid) == -1)
logit(LOG_ERR, "Warning: Could not set effective UID=%d", (int)uid);
} else if (SETEUID(uid) == -1)
logit(LOG_ERR, "Warning: Could not set effective UID=%d", (int)uid);
}