Macro $CONTACTEMAIL$ returning "$"

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
dzagyva
Posts: 5
Joined: Mon Oct 29, 2012 12:06 pm

Macro $CONTACTEMAIL$ returning "$"

Post 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
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Macro $CONTACTEMAIL$ returning "$"

Post 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.
dzagyva
Posts: 5
Joined: Mon Oct 29, 2012 12:06 pm

Re: Macro $CONTACTEMAIL$ returning "$"

Post 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.
FinFan
Posts: 3
Joined: Mon Nov 05, 2012 1:52 pm

Re: Macro $CONTACTEMAIL$ returning "$"

Post 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.
Locked