How to configure email notification from nagios.

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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to configure email notification from nagios.

Post by tmcdonald »

That's going to be a sendmail/postfix issue, not something we configure in Nagios. This article might help you:

http://semi-legitimate.com/blog/item/ho ... in-postfix
Former Nagios employee
giles
Posts: 24
Joined: Thu Aug 18, 2016 3:56 am

Re: How to configure email notification from nagios.

Post by giles »

Thanks for the link. I was able to change my outgoing email address, but still it is going to SPAM. Do you have any idea how I can send it directly to Inbox?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: How to configure email notification from nagios.

Post by avandemore »

That is an issue with your MTA or email client configuration, not something Nagios has control over. Often you can resolve this by adding the from address to your contact list thus whitelisting any email from them. Beyond that, please consult your email administrator.
Previous Nagios employee
shivam
Posts: 1
Joined: Thu Jul 27, 2017 1:29 am

Re: How to configure email notification from nagios.

Post by shivam »

To enable email alert from nagios .Perform below step:-

1.Verify that you have working sendmail or postfix mail server ,If not then install one mail server.
2.Check your entry in command.cfg file like below:

Before:
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" |/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

After:
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

==================================================================
I just changed entry from '/bin/mail' to '/usr/bin/mail'


3.Change email ID in contact.cfg file.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How to configure email notification from nagios.

Post by tgriep »

Thanks for the help @shivam
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked