$contactemail$ not expanded
Posted: 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 $
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 $