Page 2 of 2

Re: Not send e-mail notification

Posted: Thu Mar 17, 2016 6:17 am
by RockerMan
rkennedy wrote:I believe there is an error in your formatting, specifically this part serviceoutput="$SERVICEOUTPUT$"" (too many ""), and this part --service="$SERVICEDESC$" -

Try using single ' or no " at all and let us know the result. Keep in mind you'll need the " after the printf, and " before printf closes out at |

Here's a standard notify-service-by-email -

Code: Select all

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\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/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

Try using single ' or no " at all and let us know the result.
I did not testing with single quotes ', simply put in your example for e-mail sending in my code - and it worked!

Thank you very much, rkennedy :)

Topic can be closed.

Re: Not send e-mail notification

Posted: Thu Mar 17, 2016 11:30 am
by rkennedy
Good to hear! You're welcome.

Closing this one out. Feel free to make a new thread if you need any assistance in the future.