Page 1 of 1

Nagios is not sending emails

Posted: Tue Feb 27, 2018 6:44 am
by charangandra
Hi,

I've configured nagios to send email on host alerts, however even though my host is down and I can see the nagios.log outputting the alerts but there is no email notification in my Inbox.

here is my config, Am I doing anything wrong here?

define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user

email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}


define host {
use generic-host
name passive_host
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
register 0
check_period 24x7
max_check_attempts 1
check_interval 5
retry_interval 1
check_freshness 1
freshness_threshold 310
contact_groups admins
check_command check-host-alive
notifications_enabled 1
notification_interval 60
notification_period 24x7
notification_options d,u,r
}

define service {
use generic-service
name passive_service
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
register 0
check_period 24x7
max_check_attempts 1
check_interval 5
retry_interval 1
check_freshness 1
freshness_threshold 360
contact_groups admins
check_command check_dummy!0
notifications_enabled 1
notification_interval 60
notification_period 24x7
notification_options w,u,c,r
}
Thanks,
Charan

Re: Nagios is not sending emails

Posted: Tue Feb 27, 2018 3:04 pm
by mcapra
charangandra wrote: I can see the nagios.log outputting the alerts
Can you share those nagios.log entries?

How did you go about configuring email notifications? Did you follow some sort of documentation? Can we see your relevant contact definitions as well as the relevant command definitions?

Can you share this machine's mail log? Typically it can be found in /var/log/maillog. Try sending some test notifications and share the resulting /var/log/maillog file.

Re: Nagios is not sending emails

Posted: Wed Feb 28, 2018 4:59 pm
by npolovenko
Hello, @charangandra. In addition to everything that mcapra requested I'd like to ask you to show us the generic contact template:

Code: Select all

use generic-contact ; Inherit default values from generic-contact template (defined above)
Also, please show the output of:

Code: Select all

ls -l /usr/bin/printf
Thank you

Re: Nagios is not sending emails

Posted: Wed Feb 28, 2018 5:00 pm
by tgriep
Checking the /var/log/maillog file would be a good place to start.
In there, you will see the entries for when the Nagios process tried to send the email and also when the server tried to forward it on.

Most of the time, if you are using Sendmail or Postfix to route the emails, it may need to be configured to use a relay server as the emails may be blocked.

Re: Nagios is not sending emails

Posted: Mon Mar 05, 2018 7:00 am
by charangandra
I've managed to figure it out, there was no route from my machine to outside world. Opened the ports and is working.

Re: Nagios is not sending emails

Posted: Mon Mar 05, 2018 10:47 am
by scottwilkerson
Glad to hear it is resolved