Adjusting flapping percentage thresholds for a service

In this recipe, we'll learn how to adjust the percentage thresholds for a host's or service's flap detection. This means that we can adjust how frequently a host or service has to change its state within its last 21 checks before Nagios Core concludes it's flapping and suppresses notifications until its state becomes stable again.

Getting ready

You should have a Nagios Core 4.0 or newer server with at least one host and one service configured already. You should also have access to a working web interface for the Nagios Core server.

You should be familiar with the way hosts and services change their state as a result of their checks and the different states corresponding to hosts and services, to understand the basics of how flap detection works. Flap detection should also already be enabled and working for the appropriate hosts and services.

How to do it...

We can adjust the thresholds for flap detection for a specific host or service as follows:

  1. Change to the objects configuration directory for Nagios Core. The default location is /usr/local/nagios/etc/objects:
    # cd /usr/local/nagios/etc/objects
    
  2. Edit the file containing the definition for the host or service for which we want to set the thresholds:
    # vi sparta.example.net.cfg
    
  3. Within the host or service definition, set the low_flap_threshold and/or high_flap_threshold values to appropriate percentages:
    define host {
        ...
        high_flap_threshold 50.0
        low_flap_threshold 25.0
    }
    define service {
        ...
        high_flap_threshold 45.0
        low_flap_threshold 20.0
    }
  4. Validate the configuration and restart the Nagios Core server:
    # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
    # /etc/init.d/nagios reload
    

    With this done, the flapping thresholds for the host or service should be changed appropriately for future checks.

How it works...

The preceding configuration changes include the following directives:

  • high_flap_threshold: This refers to a host or service that changes its state a certain percentage of the time must exceed this percentage threshold before it is determined to be flapping
  • low_flap_threshold: If a host or service is already in the flapping state, its state change percentage must fall to this amount or fall fall below this percentage threshold before the flapping state will end

Note

For a detailed breakdown of how the state change percentage is calculated, refer to the Nagios Core 4.0 documentation online at http://nagios.sourceforge.net/docs/nagioscore/4/en/flapping.html.

There's more...

If appropriate, we can also set a global default for hosts and services' flap thresholds with the following directives in /usr/local/nagios/etc/nagios.cfg. A set of possible values for these attributes might be:

low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0

These values correspond to percentages of state changes in the same way that the per-host and per-service configurations do.

Note that there are separate directives for hosts and services in this case. These values are also overridden if you specify thresholds for a particular service or host, as we did in this recipe.

See also

  • The Managing brief outages with flapping section in this chapter
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.2.122