nagiosnrpe

Monitor Nagios client services only when NRPE on client is up


Is there any way to achieve below scenario in Nagios using NRPE?

Nagios box will first check if NRPE on client box is up and if yes it wil check on other services configured for that client. If NRPE is down on client, it will throw notification for NRPE and will stop checking rest of the services configured for that client box until NRPE comes up.


Solution

  • This setting is what are you looking for. Look at your nagios.cfg

    # DISABLE SERVICE CHECKS WHEN HOST DOWN
    # This option will disable all service checks if the host is not in an UP state
    #
    # While desirable in some environments, enabling this value can distort report
    # values as the expected quantity of checks will not have been performed
    
    host_down_disable_service_checks=1
    

    Check your hosts status via check_nrpe. Create new command in your config, if you don't have it:

    define command{
            command_name    check-host-alive-nrpe
            command_line    $USER1$/check_nrpe -H $HOSTADDRESS$
            }
    

    Now, use this command in your host definition, something like that:

    define host {
      host_name                      your_server
      address                        your_server
      use                            generic-host
      check_command                  check-host-alive-nrpe
    }
    

    When the NRPE on remote host stop responding due some problems, this host will be in CRITICAL state and remote check for services will be temporary disabled.

    After you configure this don't forget restart your Nagios service.

    PS: This setting works only with Nagios 4+