Set host notification

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Post 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
}
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Set host notification

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Set host notification

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Post by sandeepatil »

Please confirm this change will not impact on existing service monitoring flow. Service monitoring shared as before.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Set host notification

Post by cdienger »

These are separate configuration files and shouldn't have an impact on other configurations.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Set host notification

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Set host notification

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked