Nagios is not sending emails

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
charangandra
Posts: 25
Joined: Tue Feb 13, 2018 6:23 am

Nagios is not sending emails

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios is not sending emails

Post 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.
Former Nagios employee
https://www.mcapra.com/
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Nagios is not sending emails

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios is not sending emails

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
charangandra
Posts: 25
Joined: Tue Feb 13, 2018 6:23 am

Re: Nagios is not sending emails

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios is not sending emails

Post by scottwilkerson »

Glad to hear it is resolved
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked