How can enable notify via send email

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.
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can enable notify via send email

Post by baber »

rkennedy wrote:Based on the error message -

Code: Select all

Jan 24 13:51:11 Nagios postfix/error[17639]: 92B9B61615: to=<[email protected]>, relay=none, delay=256450, delays=256450/0.05/0/0.02, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=karafarinbank.ir type=MX: Host not found, try again)
It appears you need to setup DNS correctly which doesn't seem to be in place. The records do exist, but you're not resolving them. http://mxtoolbox.com/SuperTool.aspx?act ... n=toolpage

now my problem has been solved just i have other problem now one of my host with all of services has failed more than 20min but after 20min nagios send email to me why ?

BR
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: How can enable notify via send email

Post by rkennedy »

What host or service name is it?

Please post your /usr/local/nagios/var/objects.cache to go with your response as well, so we can reference your configurations.
Former Nagios Employee
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can enable notify via send email

Post by baber »

dear friend
Hi

the problem has not been solved yet
i have attached maillog and objects.cache

the name of server that is down is DNS
Attachments
attach.zip
(373.95 KiB) Downloaded 217 times
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: How can enable notify via send email

Post by rkennedy »

Are you referring to the host, or service? Your configurations vary between them all. Also, please show us the timestamps for the emails you receive through the form of a screenshot, or the mail headers.

Code: Select all

define host {
	host_name	DNS
	alias	server DNS
	address	10.11.21.193
	check_period	24x7
	check_command	check-host-alive
	contact_groups	admins
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	1.000000
	max_check_attempts	10
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	a
	freshness_threshold	0
	check_freshness	0
	notification_options	r,d
	notifications_enabled	1
	notification_interval	30.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	}

Code: Select all

define service {
	host_name	DNS
	service_description	CPU Load
	check_period	24x7
	check_command	check_nt!CPULOAD!-l 5,80,90
	contact_groups	admins
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	2.000000
	max_check_attempts	3
	is_volatile	0
	parallelize_check	1
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	a
	freshness_threshold	0
	check_freshness	0
	notification_options	r,w,u,c
	notifications_enabled	1
	notification_interval	60.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	}

define service {
	host_name	DNS
	service_description	Cpu Usage
	check_period	24x7
	check_command	check_nrpe!alias_cpu
	contact_groups	admins
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	1.000000
	max_check_attempts	3
	is_volatile	0
	parallelize_check	1
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	a
	freshness_threshold	0
	check_freshness	0
	notification_options	r,w,u,c
	notifications_enabled	1
	notification_interval	60.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	}

define service {
	host_name	DNS
	service_description	Disk Space
	check_period	24x7
	check_command	check_nrpe!alias_volumes
	contact_groups	admins
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	1.000000
	max_check_attempts	3
	is_volatile	0
	parallelize_check	1
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	a
	freshness_threshold	0
	check_freshness	0
	notification_options	r,w,u,c
	notifications_enabled	1
	notification_interval	60.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	}

define service {
	host_name	DNS
	service_description	Memory Usage
	check_period	24x7
	check_command	check_nt!MEMUSE!-w 90 -c 95
	contact_groups	admins
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	1.000000
	max_check_attempts	3
	is_volatile	0
	parallelize_check	1
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	a
	freshness_threshold	0
	check_freshness	0
	notification_options	r,w,u,c
	notifications_enabled	1
	notification_interval	60.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	}

define service {
	host_name	DNS
	service_description	Uptime
	check_period	24x7
	check_command	check_nt!UPTIME
	contact_groups	admins
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	2.000000
	max_check_attempts	3
	is_volatile	0
	parallelize_check	1
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	a
	freshness_threshold	0
	check_freshness	0
	notification_options	r,w,u,c
	notifications_enabled	1
	notification_interval	60.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	}
Former Nagios Employee
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can enable notify via send email

Post by baber »

realy could not understand your means i set contacts in contact.cfg file and contact_group with name admins and add contact group in template file for windows-server and local-service but not recieve any email i have attached all in previous posts now host with all of services has been failed but not send any email for hosts or services fail

what is problem

BR
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: How can enable notify via send email

Post by rkennedy »

baber wrote:
rkennedy wrote:Based on the error message -

Code: Select all

Jan 24 13:51:11 Nagios postfix/error[17639]: 92B9B61615: to=<[email protected]>, relay=none, delay=256450, delays=256450/0.05/0/0.02, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=karafarinbank.ir type=MX: Host not found, try again)
It appears you need to setup DNS correctly which doesn't seem to be in place. The records do exist, but you're not resolving them. http://mxtoolbox.com/SuperTool.aspx?act ... n=toolpage

now my problem has been solved just i have other problem now one of my host with all of services has failed more than 20min but after 20min nagios send email to me why ?

BR
Please show us the emails that are arriving 'late' so we can compare it to your configuration.
Former Nagios Employee
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How can enable notify via send email

Post by tgriep »

Do you want to setup the nagiosadmin contact to not forward the emails off the server but read them locally on the server?

If so, you would have to add the nagios hostname to the /etc/hosts file like the example below

Code: Select all

56.72.9.216 Nagios.localdomain
Try that and see if that fixes the delayed emails.
Be sure to check out our Knowledgebase for helpful articles and solutions!
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can enable notify via send email

Post by baber »

dear all
Hi

my problem has been solved ad now can get email but just have 2 problem:
1- for example when one of services on my host has been failed it will be send email every 1 hours that service is failed where can i set this time for example set if my service is down about 6 hours just send 2 email every 3 hours that service is down

2 - how can set when my service or host has been failed it send email after 20min ?

BR
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How can enable notify via send email

Post by tgriep »

To get the email notifications to send every 3 hours, you would have to edit the Service Check and change the Notification interval to the following.

Code: Select all

notification_interval	180
That will set it to email every 180 minutes (3 Hours).

To set the email notification delay, you will have to add this option to the host or service you want to delay emails for 20 minutes.

Code: Select all

first_notification_delay	20
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked