Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Has anyone ever added a link into the nagios alert messages that allows the receiver to just click the link to put the alert into the acknowledgement state. I've had a look around but cant see anything.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.