How to configure email alert notification?
Re: How to configure email alert notification?
Can you post the command and the contact definitions?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: How to configure email alert notification?
Hi lmiltchev,
Thanks for the reply.
1) Fortunately i am receiving mail to my email address when i change $CONTACTMAIL$ to my email address at command.cfg file. But i think its for temporarily. When i need to segregrate contacts then i need to do modify. When i use $CONTACTMAIL$ in command.cfg file i can't receive any email during device state change.
CONTACT:
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email sazzad.hussein@de.rr-icecream.eu ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
COMMAND:
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** R&R Central Network Monitoring System(NMS) *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" sazzad.hussein@de.rr-icecream.eu
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** R&R Central Network Monitoring System(NMS) *****\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/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" sazzad.hussein@de.rr-icecream.eu
}
2) Another thing is that recently i have added proxy email address(root@de.rr-icecream.eu) with my enail address by my exchange server & receiving the service notification. But i need to change this email address(From "root@mydomain" to "myemail-address@mydomain"). Could you help by sharing the path?
3) At root@mydomain email address i am reciving following message in every 10 minutes.
Subject: Cron <smmsp@RR-DE-NMS-1> test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp
Body of Message: /usr/share/sendmail/sendmail: 899: /usr/share/sendmail/sendmail: /usr/sbin/sendmail-msp: not found
Before i have installed SendMail & after that i have installed postfix. Is it happening due to SendMail? Should SendMail removal can do that resloution?
Thanks for the reply.
1) Fortunately i am receiving mail to my email address when i change $CONTACTMAIL$ to my email address at command.cfg file. But i think its for temporarily. When i need to segregrate contacts then i need to do modify. When i use $CONTACTMAIL$ in command.cfg file i can't receive any email during device state change.
CONTACT:
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email sazzad.hussein@de.rr-icecream.eu ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
COMMAND:
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** R&R Central Network Monitoring System(NMS) *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" sazzad.hussein@de.rr-icecream.eu
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** R&R Central Network Monitoring System(NMS) *****\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/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" sazzad.hussein@de.rr-icecream.eu
}
2) Another thing is that recently i have added proxy email address(root@de.rr-icecream.eu) with my enail address by my exchange server & receiving the service notification. But i need to change this email address(From "root@mydomain" to "myemail-address@mydomain"). Could you help by sharing the path?
3) At root@mydomain email address i am reciving following message in every 10 minutes.
Subject: Cron <smmsp@RR-DE-NMS-1> test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp
Body of Message: /usr/share/sendmail/sendmail: 899: /usr/share/sendmail/sendmail: /usr/sbin/sendmail-msp: not found
Before i have installed SendMail & after that i have installed postfix. Is it happening due to SendMail? Should SendMail removal can do that resloution?
Regards
Sazzad
Sazzad
Re: How to configure email alert notification?
1. If you remove $CONTACTMAIL$ from the notify-host-by-email and notify-service-by-email and just put in your email addresses, if is set to only send emails you you and no one else will receive emails at all. I would put back the $CONTACTMAIL$ in that command. If you want to receive notifications for a host or service, you will need to edit those and add the following in your checks.
That should enable the nagiosadmin to receive emails.
2. To change your From address in your emails, you will have to configure the email server you are using on the Nagios system. Are you using sendmail or postfix?
3. That looks like your cron process is sending emails and is not related to Nagios. But here is a link that may help you.
http://unix.stackexchange.com/questions ... o-dev-null
Code: Select all
contacts nagiosadmin
2. To change your From address in your emails, you will have to configure the email server you are using on the Nagios system. Are you using sendmail or postfix?
3. That looks like your cron process is sending emails and is not related to Nagios. But here is a link that may help you.
http://unix.stackexchange.com/questions ... o-dev-null
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 5
- Joined: Tue May 24, 2016 4:53 am
Re: How to configure email alert notification?
Hi ,
i have configured nagios to send mail alert using "sendmail" option. But i dint receive any mail notification like host down or up etc...But i could able to get test notification.
What i am missing here, please help
Thanks
Karthi
i have configured nagios to send mail alert using "sendmail" option. But i dint receive any mail notification like host down or up etc...But i could able to get test notification.
What i am missing here, please help
Thanks
Karthi
Re: How to configure email alert notification?
Take a look in the /var/log/maillog file when the Nagios system generated an email notification and see if there are any errors.
If you see any errors that the says the root email address is rejected, you can change the from address by adding the following option
To the end of both of these commands.
That should fix the sending of emails as root.
If you need help, post the errors from that file so we can view them.
If you see any errors that the says the root email address is rejected, you can change the from address by adding the following option
Code: Select all
-r myemail-address@mydomain
Code: Select all
notify-host-by-email
notify-service-by-email
If you need help, post the errors from that file so we can view them.
Be sure to check out our Knowledgebase for helpful articles and solutions!