Page 2 of 2
Re: How to configure email notification from nagios.
Posted: Wed Oct 05, 2016 2:32 pm
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
Re: How to configure email notification from nagios.
Posted: Thu Oct 06, 2016 8:10 am
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?
Re: How to configure email notification from nagios.
Posted: Thu Oct 06, 2016 10:38 am
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.
Re: How to configure email notification from nagios.
Posted: Thu Jul 27, 2017 1:36 am
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.
Re: How to configure email notification from nagios.
Posted: Thu Jul 27, 2017 12:13 pm
by tgriep
Thanks for the help
@shivam