Page 1 of 1

Nagios FROM email address

Posted: Wed Sep 30, 2020 1:48 pm
by MarkCampbell
This may be a stupid question, but I've been going throughout the UI looking for this and have only seen one field for the Nagios FROM email field, which I've found in nagiosxi/admin/mailsettings.php. I've changed it here to Nagios XI <[email protected]>, and when I tell it to send me a test email, I get it exactly as I typed it in... but when I receive actual alert emails, it comes as [email protected] (this server is in AWS, which defaults the hostname to the IP in dashes). Where else could this alternate email address be set?

Re: Nagios FROM email address

Posted: Thu Oct 01, 2020 5:03 pm
by benjaminsmith
HI Mark,

Thanks for trying out Nagios XI and welcome to the Nagios Customer Support Forum!

For clarification, are you using SMTP or Sendmail in your email settings ( a screenshot would be helpful)?

Regards,
Benjamin

Re: Nagios FROM email address

Posted: Thu Oct 01, 2020 5:10 pm
by MarkCampbell
I am using SMTP to connect to Amazon SES.
2020-10-01 18_08_16-Administration ยท Nagios XI.png

Re: Nagios FROM email address

Posted: Fri Oct 02, 2020 2:41 pm
by ssax
This is likely because those contacts are using the notify-host-by-email/notify-service-by-email commands. You can either do this:

https://assets.nagios.com/downloads/nag ... Mailer.pdf

Or you can edit the notify-host-by-email/notify-service-by-email commands in Configure > Core Config Manager > Commands and add an option to the mail command to set the From address:

The defaults:

notify-host-by-email:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\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:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
To: (for example, adding -S "from=Nagios XI <[email protected]>")

notify-host-by-email:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -S "from=Nagios XI <[email protected]>" -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
notify-service-by-email:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -S "from=Nagios XI <[email protected]>" -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Then apply configuration and test.

See here as well:

https://assets.nagios.com/downloads/nag ... ntacts.pdf

Re: Nagios FROM email address

Posted: Mon Oct 12, 2020 4:33 pm
by MarkCampbell
Thanks that worked, I imported my configuration from a Nagios Core instance, but didn't realize it was overriding the use of the php mailer.

Re: Nagios FROM email address

Posted: Tue Oct 13, 2020 1:32 pm
by ssax
Glad that worked for you! Let us know when we're okay to lock this up and mark it as resolved.

Thank you!

Re: Nagios FROM email address

Posted: Tue Oct 13, 2020 1:44 pm
by MarkCampbell
I think I'm good to mark this as resolved.

Re: Nagios FROM email address

Posted: Tue Oct 13, 2020 2:11 pm
by scottwilkerson
MarkCampbell wrote:I think I'm good to mark this as resolved.
Great!

Locking thread