Custom variable apear to not be working in commands
Posted: Thu Mar 21, 2013 10:04 am
Hi,
I'm running Nagios XI 2011R3.2
I have a Service Template called unix-service with a custom variable: _from_address = nagiosunix
I have a Service called check_cpu that checks for high cpu usage and it imports the Service Template unix-service.
I copied the notify-service-by-email creating notify-service-by-email-custom that includes the above custom variable:
/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n$_FROM_ADDRESS$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -- -f $_FROM_ADDRESS$
This would allow the FROM email address to be customized based on the custom variable. It would also display the output of the custom variable in the body of the email.
When check_cpu detects a warning or critical condition it sends an email but it doesn't appear the custom variable was passed to the command.
The from address is [email protected]
I was expecting: [email protected]
In the body of the email on the last line is just a $ too.
I read the section in the documentation on custom variables: http://nagios.sourceforge.net/docs/3_0/ ... tvars.html
Are custom variables support in commands?
Thanks,
Chris
I'm running Nagios XI 2011R3.2
I have a Service Template called unix-service with a custom variable: _from_address = nagiosunix
I have a Service called check_cpu that checks for high cpu usage and it imports the Service Template unix-service.
I copied the notify-service-by-email creating notify-service-by-email-custom that includes the above custom variable:
/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n$_FROM_ADDRESS$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -- -f $_FROM_ADDRESS$
This would allow the FROM email address to be customized based on the custom variable. It would also display the output of the custom variable in the body of the email.
When check_cpu detects a warning or critical condition it sends an email but it doesn't appear the custom variable was passed to the command.
The from address is [email protected]
I was expecting: [email protected]
In the body of the email on the last line is just a $ too.
I read the section in the documentation on custom variables: http://nagios.sourceforge.net/docs/3_0/ ... tvars.html
Are custom variables support in commands?
Thanks,
Chris