2

is it possible to have nagios check for host down before a service failure is sent? if a host is down or rebooted we get a lot of service notifications but just need the 1 host down..

its a really annoying issue because we linked nagios to our ticket system

update:

Im not sure what happened, we have 2 nagios environments, I just inherited the environment from the other department and it was one of their major complains with it (was also new to me since my own environment has more checks and never had this issue)

After cleaning up the (hardly functioning) environment and implementing it in a helpdesk tool (otrs) I didnt see this behaviour so I suspect the messages were just in the minds of the coworkers (since nagios was mailing several times a minute!)

its now green after a few weeks hard work and the department is very happy with it...

sorry that I didnt close this issue before and thank you for your time!

another update: finally figured it out (I think). the nagios agent (opsview) crashed so it sends out the connection refused by host messages. I think that was bothering the IT department.

1
  • Is this Nagios 2 or Nagios 3. Because I think they handle this very differently. Jul 28, 2011 at 19:56

4 Answers 4

2

Something must be misconfigured somewhere, or the host is coming up quicker than the service checks failing. Even in the URL that Khaled posted it says host checks are done on-demand when a service changes state:

Hosts are checked by the Nagios daemon:

  • At regular intervals, as defined by the check_interval and retry_interval options in your host definitions.
  • On-demand when a service associated with the host changes state.
  • On-demand as needed as part of the host reachability logic.
  • On-demand as needed for predictive host dependency checks.

This basically says that Nagios will check on set intervals, and when a service changes state. When a service breaks (goes into a WARNING/CRITICAL state), a host check is executed, and if the host is seen as down, it should suppress the service notifications, assuming you have it configured that way. Can you show us your service and host definitions, masking any hostname/addresses to protect the innocent if you want.

As a side note, I've been using Nagios for years, and never had a service alert when a host is in a down state, unless I specifically configured it to do so.

0
2

Old post, but probably worth mentioning the common enough case with hosts that are permanently configured to reject pings etc, but need to have some visible services monitored.

In these cases, as mentioned here: Nagios Hosts Down but services up, a dummy check can be used to ignore the host and use services instead.

What I tend to do (nagios 3.x) to get a meaningful host check in these cases is change the host check command to use check_tcp on a port that I know there's a monitored service on, commonly port 80, and change the check-host-alive to call this with an appropriate port:

# Alternative to 'check-host-alive' command for hosts that can't be pinged
define command {
        command_name    check-host-alive-alt
        command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}

and configure the host with

define host {
    use             some-server-template
    name            an-unpingable-webserver

    # <other host config directives>

    check_command   check-host-alive-alt!80
}

and rely on service dependencies to decide whether to check other services, and to link to your ticket system (via a custom service notification command). At least you know if the host check is down, something's wrong.

0

I don't think it is possible. Nagios does its regular scheduling for service and host checks. Also, it checks host status when a service status changes. You can have a look at this page.

I think you need to implement this mechanism yourself if you need it. For example, you can receive and store the service status change. Then, you can send the notification only if the host status does not change (as a result of another check or after some timeout).

0

This should be possible with Dependencies
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/dependencies.html
Heres a snippet from the site:

How Service Dependencies Are Tested

Before Nagios executes a service check or sends notifications out for a service, it will check to see if the service has any dependencies. If it doesn't have any dependencies, the check is executed or the notification is sent out as it normally would be. If the service does have one or more dependencies, Nagios will check each dependency entry as follows:

  • Nagios gets the current status* of the service that is being depended upon.
  • Nagios compares the current status of the service that is being depended upon against either the execution or notification failure
    options in the dependency definition (whichever one is relevant at
    the time).
  • If the current status of the service that is being depended upon matches one of the failure options, the dependency is said to have
    failed and Nagios will break out of the dependency check loop.
  • If the current state of the service that is being depended upon does not match any of the failure options for the dependency entry,
    the dependency is said to have passed and Nagios will go on and check the next dependency entry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .