$contactemail$ not expanded

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

$contactemail$ not expanded

Postby mrpardijs » Tue Jul 10, 2018 3:45 am

I'm using notify-service-by-mail, which is working in some cases, and not working in some other, I can't figure out why, I debugged the process by sending the command to a textfile, I notice that when the notification type is empty, also the $CONTACTEMAIL$ is not expanded.

My definition:

command_line /bin/echo Subject: $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$ CONTACT EMAIL $CONTACTEMAIL$ >> /tmp/contactemail

Example: the first line is where all is working fine, I have a notification type PROBLEM, and the mailaddress is displayed, in the second example, the notification type is empty, and the contact email is $ instead if my real address. So even for the same service, sometimes the notification is working fine and sometimes not. Any ideas?

Subject: PROBLEM Service Alert: gitlab is CRITICALnn***** Nagios *****nnNotification Type: PROBLEMnnService: gitlabnHost: myhostnAddress: 192.168.5.34nState: CRITICALnnDate/Time: Tue Jul 10 10:31:19 CEST 2018nnAdditional Info:nnconnect to address 192.168.5.34 and port 8080: No route to host CONTACT EMAIL my@mail.com

Subject: Service Alert: gitlab is CRITICALnn***** Nagios *****nnNotification Type: nnService: gitlabnHost: myhostnAddress: 192.168.5.34nState: CRITICALnnDate/Time: Tue Jul 10 10:31:19 CEST 2018nnAdditional Info:nnconnect to address 192.168.5.34 and port 8080: No route to host CONTACT EMAIL $
mrpardijs
 
Posts: 2
Joined: Tue Jul 10, 2018 3:31 am

Re: $contactemail$ not expanded

Postby mcapra » Tue Jul 10, 2018 9:52 am

Which version of Nagios Core are you using?

Do you also have an event handler configured anywhere that might be firing? That's Occam's razor in this case; That the second execution is not actually a notification handler, but an event handler that doesn't have access to those macros ($NOTIFICATIONTYPE$ and $CONTACTEMAIL$).
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3313
Joined: Thu May 05, 2016 3:54 pm

Re: $contactemail$ not expanded

Postby scottwilkerson » Tue Jul 10, 2018 2:47 pm

I think @mcapra is onto something here

mcapra wrote:Do you also have an event handler configured anywhere that might be firing? That's Occam's razor in this case; That the second execution is not actually a notification handler, but an event handler that doesn't have access to those macros ($NOTIFICATIONTYPE$ and $CONTACTEMAIL$).
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 10514
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: $contactemail$ not expanded

Postby mrpardijs » Wed Jul 11, 2018 3:46 am

That was it! I had configured my notify command as event_handler, after enabling the notification_event options it's all working now, thanks.
mrpardijs
 
Posts: 2
Joined: Tue Jul 10, 2018 3:31 am

Re: $contactemail$ not expanded

Postby scottwilkerson » Wed Jul 11, 2018 8:21 am

mrpardijs wrote:That was it! I had configured my notify command as event_handler, after enabling the notification_event options it's all working now, thanks.


Great! Glad it is resolved

Locking
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 10514
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 13 guests