Changing from address in email notification
-
yunushaikh
- Posts: 176
- Joined: Sat Jun 20, 2015 9:04 pm
Changing from address in email notification
I am trying to change the "send from" address from the manage email alerts option. When I test the email after updating the settings it sends email correctly using that email id. But when the notification comes from host or service it is coming by default email id of the server "nagios@ipaddress"
Can you please help me in troubleshooting this problem?
Can you please help me in troubleshooting this problem?
Re: Changing from address in email notification
It sounds like you may have notify-host-by-email assigned to your contact, instead of xi_host_notification_handler. (and also the same service reciprocals)
You'll want to adjust this, as xi_host_notification_handler is what respects the Manage Email Settings page, where as the notify-host-by-email just uses sendmail.
If that doesn't help, please post the contact definition for us to look at.
You'll want to adjust this, as xi_host_notification_handler is what respects the Manage Email Settings page, where as the notify-host-by-email just uses sendmail.
If that doesn't help, please post the contact definition for us to look at.
Former Nagios Employee
-
yunushaikh
- Posts: 176
- Joined: Sat Jun 20, 2015 9:04 pm
Re: Changing from address in email notification
define contact {rkennedy wrote: please post the contact definition for us to look at.
contact_name <Name>
alias <Name >
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s,
service_notification_options w,u,c,r,f,s,
host_notification_commands xi_host_notification_handler
service_notification_commands xi_service_notification_handler
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
email <here it is a company email id>
use xi_contact_generic
}
I configured this with xi notification handler but still it does not work. I did 1 more thing, I created only a contact and set the notification command to notify-service-by-email and edited the command with -r option for /bin/mail. That option is sending an email from the email id which I want.
But I need this to work from the Nagios XI email setting feature. Please help and let me know if you need any more information. I can send you the service definition also which I am using for monitoring.
define service {
host_name localhost
service_description Service Status - ntpd
use local-service
check_command check_xi_service_status!ntpd!!!!!!!
initial_state o
max_check_attempts 1
check_interval 2
retry_interval 1
active_checks_enabled 1
check_period 24x7
event_handler nagios_otrs
event_handler_enabled 1
flap_detection_enabled 0
flap_detection_options o,w,c,u,
process_perf_data 1
notification_interval 5
notification_period 24x7
notification_options w,c,u,r,f,s,
notifications_enabled 1
contacts <Contact is present which is configured>
register 1
}
-
yunushaikh
- Posts: 176
- Joined: Sat Jun 20, 2015 9:04 pm
Re: Changing from address in email notification
One more thing I would like to highlight is that I tried to check maillog when the alert gets triggered but there is nothing triggered in maillog for sending an email when I configure xi-service-notification-handler
Hope this will help you for some troubleshooting.
Hope this will help you for some troubleshooting.
Re: Changing from address in email notification
Can you show us a screenshot of the manage email settings page? I believe it will need to be modified here for the xi_host_notification_handler commands.
The notify-host-by-email works because it's sending right to /bin/mail with your specified options.
The notify-host-by-email works because it's sending right to /bin/mail with your specified options.
Former Nagios Employee
-
yunushaikh
- Posts: 176
- Joined: Sat Jun 20, 2015 9:04 pm
Re: Changing from address in email notification
Please check the screenshot and let me know if any changes needs to be done
You do not have the required permissions to view the files attached to this post.
Re: Changing from address in email notification
Please send the output of this command:
Also, please go to Admin > Manage Email Settings
- Check the Debug Log option
- Click the Update Settings button
Then generate some test emails and send us the contents of /usr/local/nagiosxi/tmp/phpmailer.log.
Thank you
Code: Select all
alternatives --display mta- Check the Debug Log option
- Click the Update Settings button
Then generate some test emails and send us the contents of /usr/local/nagiosxi/tmp/phpmailer.log.
Thank you
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Changing from address in email notification
Please attach /var/log/maillog after one of these failed send attempts.
Previous Nagios employee
-
yunushaikh
- Posts: 176
- Joined: Sat Jun 20, 2015 9:04 pm
Re: Changing from address in email notification
alternatives --display mtassax wrote:Please send the output of this command:
Code: Select all
alternatives --display mta
mta - status is auto.
link currently points to /usr/sbin/sendmail.sendmail
/usr/sbin/sendmail.postfix - priority 30
slave mta-pam: /etc/pam.d/smtp.postfix
slave mta-mailq: /usr/bin/mailq.postfix
slave mta-newaliases: /usr/bin/newaliases.postfix
slave mta-rmail: /usr/bin/rmail.postfix
slave mta-sendmail: /usr/lib/sendmail.postfix
slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
/usr/sbin/sendmail.sendmail - priority 90
slave mta-pam: /etc/pam.d/smtp.sendmail
slave mta-mailq: /usr/bin/mailq.sendmail
slave mta-newaliases: /usr/bin/newaliases.sendmail
slave mta-rmail: /usr/bin/rmail.sendmail
slave mta-sendmail: /usr/lib/sendmail.sendmail
slave mta-mailqman: /usr/share/man/man1/mailq.sendmail.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
Current `best' version is /usr/sbin/sendmail.sendmail.
I enabled debug log and there is no log getting generated in phpmailer.log. I think the command is not able to send the email itself.
Logs are also not getting generated in maillog file as the mail is not getting triggered from xi_service_notification_commandavandemore wrote:/var/log/maillog
Re: Changing from address in email notification
Please run this command and see if it resolves the issue:
If that doesn't fix it, revert with this command:
Let us know the results.
Thank you
Code: Select all
alternatives --set mta /usr/sbin/sendmail.postfixIf that doesn't fix it, revert with this command:
Code: Select all
alternatives --set mta /usr/sbin/sendmail.sendmailThank you