Page 1 of 1
Change From email address in NagiosXI
Posted: Mon Oct 22, 2018 1:38 am
by niaccarino
Hi there,
I am just wondering how I can change the default "from:" email address in Nagios XI?
In the General Email Settings, I have configured to "Send Mail from:" the email address I want to send from, however the emails I receive are still from
[email protected].
I have tested changing the nagios.cfg and adding the correct Admin Email address, and also updated the commands.cfg to send from $ADMIN$ which then works, however, there surely must be a way to do it once and for all in the GUI given this is a paid product?
Any help would be much appreciated!
Thanks,
Nino
Re: Change From email address in NagiosXI
Posted: Mon Oct 22, 2018 10:33 am
by benjaminsmith
Hi
@Nino,
Did use <> brackets in the general mail settings? They are required, and the mail program may use the system default if they are left out.
Plain Text Name <[email protected]>
Please let me know.
Re: Change From email address in NagiosXI
Posted: Mon Oct 22, 2018 10:57 am
by lmiltchev
When you create xi users, who are also contacts in Nagios XI, then they would be using the
xi_host_notification_handler and
xi_service_notification_handler commands, and php mailer. In this case, setting the "from address" would work just fine (Admin > System Config > Manage Email Settings > Send Mail From > <your "from" email address>).
However, if your contacts are "contacts only" (not xi users), then they will be using the
notify-host-by-email and
notify-service-by-email commands, and sendmail/postfix. In this case, setting the "from address" under the "Mail Settings" page won't work. You could still modify your commands from the GUI, and add the "from address" though.
For example, I am using mailx, so I added my "from" address to the notification handlers, using the "-r" flag.
Example:
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 -r [email protected] -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
You could also configure your core contacts to use the Nagios XI php mailer settings. Please, review our documentation on the topic here:
https://assets.nagios.com/downloads/nag ... Mailer.pdf
Hope this helps.
Re: Change From email address in NagiosXI
Posted: Mon Oct 22, 2018 6:11 pm
by niaccarino
Thanks very much for your reply. I ended up changing the notify commands to include the from email address.
Thank you,
Nino
Re: Change From email address in NagiosXI
Posted: Tue Oct 23, 2018 8:41 am
by lmiltchev
I am glad I could help! I will be closing this topic now. If you have any further questions, please start a new thread. Thanks!