I have succeded to add the action url to the email and almost also a link to acknowledge the problem.
The remaining issue is that the service description contains a “blank” () and when the link is displayed in outlook the part after the is not included in the url. I need to replace with “+”.
Is it possible to apply string operations to a macro in Nagios?
another minor issue that I have not looked into is if I can reference the nagios server name as a macro (localhost).
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "----My error report for $HOSTNAME$\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nServer: $HOSTNAME$\nDescription: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nActionURL: $SERVICEACTIONURL$\nAcknowledge Problem: 'http://10.10.10.10/nagios/cgi-bin/cmd.cgi?cmd_typ=34&host=$HOSTNAME$&service=$SERVICEDESC$'\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$($HOSTALIAS$)/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -a "From: [email protected]"
}