Set host notification

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: Set host notification

Postby sandeepatil » Fri Nov 22, 2019 8:48 am

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
}
sandeepatil
 
Posts: 196
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Postby benjaminsmith » Fri Nov 22, 2019 2:38 pm

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!
User avatar
benjaminsmith
 
Posts: 1955
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Set host notification

Postby sandeepatil » Fri Nov 22, 2019 2:58 pm

I am confuse, above template set for service check, how can use for host down as explained before.

What you mean by main configuration.
sandeepatil
 
Posts: 196
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Postby cdienger » Fri Nov 22, 2019 5:39 pm

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

Re: Set host notification

Postby sandeepatil » Mon Nov 25, 2019 5:16 am

Please confirm this change will not impact on existing service monitoring flow. Service monitoring shared as before.
sandeepatil
 
Posts: 196
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Postby cdienger » Mon Nov 25, 2019 2:10 pm

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

Re: Set host notification

Postby sandeepatil » Tue Nov 26, 2019 2:00 pm

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.
sandeepatil
 
Posts: 196
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Postby cdienger » Tue Nov 26, 2019 3:04 pm

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

Re: Set host notification

Postby sandeepatil » Tue Dec 03, 2019 1:38 pm

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.
sandeepatil
 
Posts: 196
Joined: Tue Dec 27, 2016 3:12 am

Re: Set host notification

Postby cdienger » Wed Dec 04, 2019 5:37 pm

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

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 17 guests