Page 2 of 3

Re: Set host notification

Posted: Fri Nov 22, 2019 8:48 am
by sandeepatil
We service definition as below, this is useful to achieve expected alarms.
define service {
name passive_service
service_description Passive Service
check_command core_check_dummy!0!"No data received yet."!!!!!!
is_volatile 1
initial_state o
max_check_attempts 1
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
contact_groups admins
stalking_options o,w,c,u
register 0
}

Re: Set host notification

Posted: Fri Nov 22, 2019 2:38 pm
by benjaminsmith
Hi @sandeeptail,

Make sure you have freshness enabled in the main configuration file. Also, check_dummy with a 0 argument will return OK state? Is this what you want?

Re: Set host notification

Posted: Fri Nov 22, 2019 2:58 pm
by sandeepatil
I am confuse, above template set for service check, how can use for host down as explained before.

What you mean by main configuration.

Re: Set host notification

Posted: Fri Nov 22, 2019 5:39 pm
by cdienger
You will need two checks - one for the host and one for the service. The host check is an active check and would be what you have already:

Code: Select all

define host{
   host_name         new-host
   alias                     Sample Host Config
   address            192.168.1.10
   check_command      check-host-alive
   check_interval         15
    max_check_attempts        1
   check_period         24x7
   process_perf_data      0
   retain_nonstatus_information   0
   contact_groups         network-admins
   notification_interval      30
   notification_period      24x7
   notification_options      d,u,r
   active_checks_enabled   1
   passive_checks_enabled   1
    notifications_enabled   1
    flap_detection_enabled   0
    event_handler_enabled   1
    process_perf_data   1
   }
The second check will be a passive check and look like:

Code: Select all

define service {
host_name new-host
service_description Passive Service
check_command check_dummy!0!"No data received yet."!!!!!!
is_volatile 1
initial_state o
max_check_attempts 1
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
contact_groups admins
stalking_options o,w,c,u
register 0
freshness_threshold   300
}
The freshness_threshold will cause the check_command(check_dummy in this case) to run if a passive result isn't received within the last 5 minutes.

Does this help?

Re: Set host notification

Posted: Mon Nov 25, 2019 5:16 am
by sandeepatil
Please confirm this change will not impact on existing service monitoring flow. Service monitoring shared as before.

Re: Set host notification

Posted: Mon Nov 25, 2019 2:10 pm
by cdienger
These are separate configuration files and shouldn't have an impact on other configurations.

Re: Set host notification

Posted: Tue Nov 26, 2019 2:00 pm
by sandeepatil
Will check this configuration,

Below definition first show, SOFT sate and alert after 15 min.
define host{
name passive_host
check_interval 1
max_check_attempts 1
retry_interval 15
check_period 24x7
notification_options d,u,r
active_checks_enabled 1
passive_checks_enabled 1
register 0
}
Except below flow,
1) Server down alarm in 1 min (Hard State)
2) recheck every 15 minutes.
3) If server still down repeat alarm after 30 minutes.

Re: Set host notification

Posted: Tue Nov 26, 2019 3:04 pm
by cdienger
retry_interval does not apply to passive checks. With max_check_attempts set to 1 it will send a notifications for down, unreachable, and and recoveries(notification_options). "notification_period 30" needs to be added to send notifications every 30 minutes for this check.

Re: Set host notification

Posted: Tue Dec 03, 2019 1:38 pm
by sandeepatil
Below host template configured in template.cfg. After set this, host monitoring is flapping and 20-30 host frequently up and down among 500 hosts.

Need your help to fix the flapping host issue.
define host {
name generic-host
max_check_attempts 5
check_interval 5
check_period 24x7
event_handler_enabled 1
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 30
notification_period 24x7
notifications_enabled 1
contact_groups admins
register 0
}

######################################################################
# Core passive host template

define host {
name passive_host
use generic-host
max_check_attempts 15
check_interval 1
active_checks_enabled 0
passive_checks_enabled 1
check_period 24x7
check_freshness 1
freshness_threshold 60
register 0
}


Except below flow,
1) Server down alarm in 1 min (Hard State)
2) recheck every 15 minutes.
3) If server still down repeat alarm after 30 minutes.

Re: Set host notification

Posted: Wed Dec 04, 2019 5:37 pm
by cdienger
Flapping has a specific meaning in Nagios:

https://assets.nagios.com/downloads/nag ... pping.html

flap_detection_enabled is currently disabled on the host so you'll receving notification each time there is a state change. You can enable it by setting it:

Code: Select all

flap_detection_enabled 1
To find out why it is changing states you'll need to look into the checks and see why they may be going from OK to WARNING or CRITICAL and address that.