0

I'm trying to get some third-party and my own custom checks running.

The current test setup consists of one icinga(web)2 CentOS 7 server and one CentOS 7 client with NRPE installed within the same network and firewalld has been disabled.

The check_service plugin I'm trying to run uses systemctl is-active.

Running the check on the client gives back the right result:

[root@localhost ~]# sudo -u nrpe /usr/lib64/nagios/plugins/check_service -s docker
OK: Service docker is running!

When ran from the Icinga2 server it results in a 'Service not running' message even though the service is running on the client:

[root@icinga2 ~]# /usr/lib64/nagios/plugins/check_nrpe -H 192.168.100.153 -c check_docker_service
CRITICAL: Service docker is not running!

All of the standard tests are running correctly when called from Icinga2.


Client:

/etc/sudoers

[...]
nrpe    ALL=NOPASSWD:/bin/systemctl is-active docker,/usr/lib64/nagios/plugins/check_service
nagios  ALL=NOPASSWD:/bin/systemctl is-active docker,/usr/lib64/nagios/plugins/check_service
[...]

/etc/nagios/nrpe.cfg

log_facility=daemon
debug=0
pid_file=/var/run/nrpe/nrpe.pid
server_port=5666
nrpe_user=nrpe
nrpe_group=nrpe
allowed_hosts=127.0.0.1,::1,192.168.100.151
dont_blame_nrpe=0
allow_bash_command_substitution=0
command_timeout=60
connection_timeout=300
[...some working default checks...]
command[check_docker_service]=/usr/lib64/nagios/plugins/check_service -s docker
include_dir=/etc/nrpe.d/

Server:

/etc/icinga2/conf.d/hosts/test.conf

object Host "Host 1" {
    import "generic-host"
    address = "192.168.100.153"
    vars.os = "Linux"
    vars.sla = "24x7"
}

object Service "Docker" {
    import "generic-service"
    host_name = "Host 1"
    check_command = "nrpe"
    vars.nrpe_command = "check_docker_service"
}
1

On the nrpe side the selinux is in enforcing mode.

Test the script again after:

# setenforce 0

With selinux enabled in enforcing mode you need to configure file context:

# semanage fcontext -a -t nagios_admin_plugin_exec_t check_service
# restorecon -R -v check_service

See: nagios_selinux

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.