Adding a acknowledgement Link to Nagios Alert Emails

Add a notes_url into service definition:

notes_url           http://domain.com/nagios/cgi-bin/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$

And append the $SERVICENOTESURL$ macro to the end of alert message, in notify-service-by-email command, Eg:

define command{
    command_name    notify-service-by-email
    command_line    /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: $SERVICEOUTPUT$\n\nURL: $SERVICENOTESURL$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ 
    }

Do the same for host.


You'd need to add a link to your alert script similar to what's below.

For services: http://your-nagios-server.example.com/nagios/cgi-bin/cmd.cgi?cmd_typ=34&host=$NAGIOS_HOSTNAME&service=$NAGIOS_SERVICEDESC

For hosts: http://your-nagios-server.example.com/nagios/cgi-bin/cmd.cgi?cmd_typ=33&host=$NAGIOS_HOSTNAME

What exactly needs to be done depends on your alert script's logic. Keep in mind that the Nagios UI uses frames and these links will only show the Acknowledgement form page without the Nagios navigation bar on the left.