Page 1 of 2

Nagios Mail Setting - Send Mail From

Posted: Wed Oct 17, 2018 12:37 am
by amozahim
Dears
I have installed latest nagios version, and configure it and it is working fine.

The only problem is in mail setting I added Send Mail From: [email protected] but I received emails from nagios@NagiosServerName.

Although we have a testing one and working fine with same configuration.

Re: Nagios Mail Setting - Send Mail From

Posted: Wed Oct 17, 2018 11:08 am
by npolovenko
Hello, @amozahim. Can you check to see which notification commands are being used? In Core Configurations Manager go to the Contacts menu in the left column, select a contact and go to the Alert Settings tab. You can find the commands under Manage Host Notification Commands and Manage Service Notification Commands.

Re: Nagios Mail Setting - Send Mail From

Posted: Thu Oct 18, 2018 12:25 am
by amozahim
Thanks For Reply
I used the default command in notify_host_by_email command definition

/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$

Re: Nagios Mail Setting - Send Mail From

Posted: Thu Oct 18, 2018 12:27 am
by amozahim
npolovenko wrote:Hello, @amozahim. Can you check to see which notification commands are being used? In Core Configurations Manager go to the Contacts menu in the left column, select a contact and go to the Alert Settings tab. You can find the commands under Manage Host Notification Commands and Manage Service Notification Commands.

The default Command notify_host_by_email

/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$

Re: Nagios Mail Setting - Send Mail From

Posted: Thu Oct 18, 2018 10:11 am
by npolovenko
@amozahim, The notify_host_by_email and notify_service_by_email commands are using the default sendmail script. In order to be able to use SMTP you need to change notification commands to xi_host_notification_handler and xi_service_notification_handler.
PS: Each contact that is using the notification_handler commands needs to have a corresponding username in XI.

Re: Nagios Mail Setting - Send Mail From

Posted: Sun Oct 28, 2018 7:30 am
by amozahim
I still Receive emails using notify_host_by_email which is not SMTP
I use xi_host_notification_handler to use SMTP but still not working to send emails although I create user and use the contact for that user.

although send_test_email is working fine

Re: Nagios Mail Setting - Send Mail From

Posted: Mon Oct 29, 2018 1:56 am
by amozahim
We Have about 100 host, and we have 5 admins
every admin has 20 host
we need to send notification email about the host status, each admin will receive notification for his own hosts only.

We configure it with send mail (notify_host_by_email) and work fine, but we need to use SMTP, how to use xi_host_notification_handler ?

we do not know how to do it

Re: Nagios Mail Setting - Send Mail From

Posted: Mon Oct 29, 2018 10:39 am
by npolovenko
Hello, @amozahim . I see on the screenshot that you added the xi_host_notification_handler command as the second notification command. You should delete the old commands -> notify-host-by-email and notify-service-by-email from the assigned notification commands and leave only the new ones.
every admin has 20 host
we need to send notification email about the host status, each admin will receive notification for his own hosts only.
This is possible to set up. You need to open each host in Core Configurations Manager and make sure that it's only assigned to the corresponding XI contact.
Each contact needs to have a corresponding username.
You also need to sign in to the XI as each user, click on the username next to the logout button(in top right corner), click on Notification Preferences in the left column and make sure that Enable Notifications is checked. Then go to the Notification Methods menu in the left column and check "Recieve alerts via email".

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: Nagios Mail Setting - Send Mail From

Posted: Thu Nov 01, 2018 12:18 am
by amozahim
Thank You Very much :)

Re: Nagios Mail Setting - Send Mail From

Posted: Thu Nov 01, 2018 10:20 am
by npolovenko
@amozahim, You're welcome! Are we ready to lock this thread as resolved?