Service notifications work fine, this only seems to happen on host notifications.
When a host goes down, or is acknowledged, or returns to service and an alert is generated, the emails to: address, in the mail message, is being set to the Send From address defined in the Email Settings page. Not the defined $CONTACTEMAIL$ address.
Service notifications work fine and the actual $CONTACTEMAIL$ is sent to the mailer.
I am using basic notify-host-by-email and notify-service-by-email commands.
The notifications report shows the emails going to the correct address, but the mail logs do not reflect this.
Any thing I can check? The test email function works fine and the email is sent to the appropriate contact.
Profile attached
NagiosXI 5.6.10
Moderator's Note: The profile has been shared with the support team but has been removed from the public forum.
Host notifications sending wrong $CONTACTEMAIL$
-
Farmer John
- Posts: 3
- Joined: Fri Feb 03, 2017 3:50 pm
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Host notifications sending wrong $CONTACTEMAIL$
The Email Settings page under Admin is only for Report sending and when using the xi_host_notification_handler & xi_service_notification_handler
If you look at your notify-host-by-email and notify-service-by-email the FROM address is being set in the command following the -r flag.
If you look at your notify-host-by-email and notify-service-by-email the FROM address is being set in the command following the -r flag.
-
Farmer John
- Posts: 3
- Joined: Fri Feb 03, 2017 3:50 pm
Re: Host notifications sending wrong $CONTACTEMAIL$
The -r address is coming through fine, it is the contacts that seems to get dropped and substituted with the -r address.
notify commnds are below commands are below:
/usr/bin/printf "%b" "-BLAH Monitoring Systems-\nDate/Time: $LONGDATETIME$\n\nService: $SERVICEDESC$ on Host: $HOSTALIAS$\nReported $SERVICEOUTPUT$\nCurrent state is: $SERVICESTATE$\n" |
/bin/mail -r "[email protected]" -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
/usr/bin/printf "%b" "-BLAH Monitoring Systems-\nDate/Time: $LONGDATETIME$\n\nHost: $HOSTNAME$ reported $LONGHOSTOUTPUT$\nCurrent State: $HOSTSTATE\n"|
/bin/mail -r "[email protected]" -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
Why the service notification works and the host notification seems to have this issue has me puzzled.
notify commnds are below commands are below:
/usr/bin/printf "%b" "-BLAH Monitoring Systems-\nDate/Time: $LONGDATETIME$\n\nService: $SERVICEDESC$ on Host: $HOSTALIAS$\nReported $SERVICEOUTPUT$\nCurrent state is: $SERVICESTATE$\n" |
/bin/mail -r "[email protected]" -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
/usr/bin/printf "%b" "-BLAH Monitoring Systems-\nDate/Time: $LONGDATETIME$\n\nHost: $HOSTNAME$ reported $LONGHOSTOUTPUT$\nCurrent State: $HOSTSTATE\n"|
/bin/mail -r "[email protected]" -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
Why the service notification works and the host notification seems to have this issue has me puzzled.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Host notifications sending wrong $CONTACTEMAIL$
Where are you seeing that the host notifications are being sent to the -r address?
Are you sure they aren't just bouncing?
Is this every host?
I did notice this, in your host command it has this
where it should be this
That could cause a problem
Are you sure they aren't just bouncing?
Is this every host?
I did notice this, in your host command it has this
Code: Select all
Current State: $HOSTSTATE\n"Code: Select all
Current State: $HOSTSTATE$\n"-
Farmer John
- Posts: 3
- Joined: Fri Feb 03, 2017 3:50 pm
Re: Host notifications sending wrong $CONTACTEMAIL$
The Current State: $HOSTSTATE\n" looks to have been the issue.
I have updated the commands to Current State: $HOSTSTATE$\n" and now the messages show the correct information and the $CONTACTEMAIL$ is now being passed. Good deal.
Thanks for your help. I believe this is solved.
I have updated the commands to Current State: $HOSTSTATE$\n" and now the messages show the correct information and the $CONTACTEMAIL$ is now being passed. Good deal.
Thanks for your help. I believe this is solved.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Host notifications sending wrong $CONTACTEMAIL$
Awesome!Farmer John wrote:The Current State: $HOSTSTATE\n" looks to have been the issue.
I have updated the commands to Current State: $HOSTSTATE$\n" and now the messages show the correct information and the $CONTACTEMAIL$ is now being passed. Good deal.
Thanks for your help. I believe this is solved.
Glad to help
Locking thread