Nagios Core email 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.
Locked
jplamb13
Posts: 6
Joined: Sat Apr 23, 2016 2:20 am

Nagios Core email notification

Post by jplamb13 »

Is anybody able to support with setting up email notifications for Nagios Core? i have followed loads of guides but have not managed to get it working.

I have defined a contact as below (i have replaced the email address for this post)

Code: Select all

define contact{
	contact_name			JLamb
	alias				JLamb
	email				[email protected]
	service_notification_commands	notify-service-by-email
	host_notification_commands	notify-host-by-email
	service_notification_period	24x7
	host_notification_period	24x7
	service_notification_options	w,u,c,r,f,s
	host_notification_options	d,u,r,f,s
	register			1
}
I have then have the following to define a host and have it send the notifications.

Code: Select all

define host{
     	use          	generic-router
     	host_name	apps4
     	alias		apps4
     	address		10.20.43.111
	parents		Virtual Servers
	notifications_enabled	1
	notification_period	24x7
	notification_interval	30
	notification_options d,u,r,f,s
	contacts	JLamb
	#hostgroups	windows-servers,ping-only
	hostgroups	ping-only, windows-servers
}

I have checked that postfix is running as i understand that this is the service which send the emails. i have not changed any configuration for this so this may be where the problem lies. do i need to give it an smtp server?

Code: Select all

[root@localhost sysadmin]# postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 32284
[root@localhost sysadmin]#


Any help with this will be much appreciated!

Many thanks
ThomasJohansen
Posts: 13
Joined: Wed Dec 30, 2015 6:47 am

Re: Nagios Core email notification

Post by ThomasJohansen »

Not sure about it is required but have you tried to add

use generic-contact

when you define contact (in contacts.cfg) ?
ThomasJohansen
Posts: 13
Joined: Wed Dec 30, 2015 6:47 am

Re: Nagios Core email notification

Post by ThomasJohansen »

You mention you haven't configured postfix yet, that could very well be the issue.

The files you wish to look into is main.cf and master.cf

You could also try type the following at the commandline

"Mail <enter your email>" without " and <> #then it ask for subject line
"TEST"
"."

and se if it sentout. (check your postfix log (might be in /var/log/maillog)


another thing in nagios, check your (see below) in commands.cfg

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line ..
...
...
...
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line ...
...
...
...
}
ThomasJohansen
Posts: 13
Joined: Wed Dec 30, 2015 6:47 am

Re: Nagios Core email notification

Post by ThomasJohansen »

Several things to look for...

1. Make sure it's possible to sent e-mail from the postfix. http://www.postfix.org/BASIC_CONFIGURATION_README.html
2. Make sure it's possible for postfix to recieve e-mail.

Do you get any errors in your maillog?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Core email notification

Post by tmcdonald »

I'm leaning towards postfix as well, your configs look fine.

If you check your nagios.log file do you see any mentions of notification commands being run?
Former Nagios employee
Locked