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

Set host notification

Post by sandeepatil »

We having passive check and need to set active check for host down.
Need your help to set below details. We have 1000 host and 80k+ services with nagios core. Nagios core version 4.3.4

Check Interval: 15min
Max Checks: 1 (i.e. send alert on the first error [Hard State])
Resend Interval: 30min
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Set host notification

Post by benjaminsmith »

Hello @sandeepatil,

If you need help configuring a host definition, the Core documentation is really useful.

Nagios Core Object Definitions

So for example:

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
	}
You can run the following command to verify your configurations.

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
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 »

Thanks for sharing details, we will test,

FYI, below is current host temple using. Need your suggestion.

1) This ok for 1000 host, if 100+ host down badly affected on server resources ?
2) What about retry_interval and freshness_threshold, this is required to achieve my expected host notification ?
define host {
name core_passive_host
check_command core_check_dummy!2!"Missing NagiosAgent Heartbeat from $HOSTNAME$"!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
active_checks_enabled 0
passive_checks_enabled 1
check_period 24x7
check_freshness 1
freshness_threshold 600
event_handler_enabled 1
flap_detection_enabled 0
process_perf_data 1
notification_interval 30
notification_period 24x7
notifications_enabled 1
register 0
}
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Set host notification

Post by benjaminsmith »

Hello @sandeepatil,

I hope the information provided has helped, and in regards to your questions.

1. I would recommend making changes on a test host or test server until it's working to your requirements before applying the changes to all the other hosts.

2. The retry_interval is not required and will default to 60 seconds minutes if not set. The freshness_threshold is not required as well. In the Nagios Core Object Definitions, you'll find a red * next to the required parameters.
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 »

Shared information is helpful to understand the flow.

Question :

Can we separate passive agent down alarm and actual host down alarm. ?

If agent is not working / down, then want to receive agent down alarm and actual host down, then want to receive host down alarm.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Set host notification

Post by benjaminsmith »

Hello @Sandeepatil,
Can we separate passive agent down alarm and actual host down alarm. ?
If agent is not working / down, then want to receive agent down alarm and actual host down, then want to receive host down alarm.
Can you clarify what you mean by "separate passive agent down and actual host down"?

Typically, freshness checking is used to send a non-ok check result if Nagios has not received a passive check within a certain timeframe (stale results). See the following documentation for how to set this up in Nagios Core.

Service and Host Freshness Checks
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 »

1) Passive agent running on the server and agent is not working or for any reason stopped, but server is up and running. In this scenario, agent not sending to server, for this want alarm agent down.

2) Server is disconnected from network or unable to ping, for this want server down alarm.

In other way, can we set if agent not working alarm is DOWN and server disconnected from network alarm is UNREACHABLE.

This need because agent not working / down is not critical, then server down. So we want separate this alarm and set priority to tickets.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Set host notification

Post by benjaminsmith »

Hello @sandeepatil,

Yes, you can achieve this using freshness checking. Did you take a look a the guide as there is an example configuration?

So you set the freshnesss_threshold to your requirements.

Code: Select all

define service{
	host_name		backup-server
	service_description	ArcServe Backup Job
	active_checks_enabled	0		; active checks are NOT enabled
	passive_checks_enabled	1		; passive checks are enabled (this is how results are reported)
	check_freshness		1
	freshness_threshold	93600		; 26 hour threshold, since backups may not always finish at the same time
	check_command		no-backup-report	; this command is run only if the service results are "stale"
	...other options...
	}
Then once this threshold as passed and not result has been sent since the server as it is disconnected or the agent is not running, Nagios will run the check command defined. Usually check_dumnmy is used to send a non-ok result to force the host or service to alert.

Code: Select all

define command{
	command_name	no-backup-report
	command_line	/usr/local/nagios/libexec/check_dummy 2 "CRITICAL: Results of backup job were not reported!"
	}
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 think, you asking me to create new service for checking host status with freshness_threshold, right ?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Set host notification

Post by benjaminsmith »

Hello @sandeepatil,

If you already of the passive service defined then it's just a matter of enabling freshness checking.
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!
Locked