Page 1 of 1

Macro $CONTACTEMAIL$ returning "$"

Posted: Mon Oct 29, 2012 3:23 pm
by dzagyva
Hello,

I am trying to get my alerts working in Nagios Core and have found that my notify-host-by-email and my notify-service-by-email are not sending emails to the users I want to. The issue seems to be with the $CONTACTEMAIL$ macro at the end of my commands.

Code: Select all


/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$


/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" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$


I my maillog I see that the to field is to=$, nagios is not reporting the correct contacts.

Putting my personal email address at the end of the notification scripts works.

I have

NagiosĀ® Coreā„¢ 3.4.1
Centos 6.2
Postfix with relay host configured

Re: Macro $CONTACTEMAIL$ returning "$"

Posted: Tue Oct 30, 2012 9:52 am
by mguthrie
Does the email address have any special characters in it other than the @ sign? If so they might need to be escaped with a backslash.

Re: Macro $CONTACTEMAIL$ returning "$"

Posted: Tue Oct 30, 2012 10:23 am
by dzagyva
Thanks for the reply. No it didn't I replaced $CONTACTEMAIL$ with an exchange account address that we set up and host alerts work.

Not sure why the macro would not work.

Re: Macro $CONTACTEMAIL$ returning "$"

Posted: Mon Nov 05, 2012 3:36 pm
by FinFan
Sounds to me, though obvious, that you have an issue in your contacts.cfg file. Check for syntax, and any out of place whitespace characters. Also check templates.cfg and make sure you are correctly associated the contact or contact group.