Comment field in Acknowledgement alert emails


#1

Right now, when we acknowledge an issue in Nagios and the acknowledgement email is sent out it doesnt include the comment field in the email. I need the steps to configure it so we can have the comments that are typed when an acknowledgement email is sent.

Thanks!


#2

Ckeck your commands.cfg file. In there you should have definitions of notification commands that are configurable. If you want Acknowledge author and acknowledge comment to be visible, you have to set it in this way:

‘host-notify-by-email’ command definition

define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios \n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTALIAS$\nState: $HOSTSTATE$ for $HOSTDURATION$\nAddress: $HOSTADDRESS$\nInfo:\n\n$HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nACK by: $HOSTACKAUTHOR$\nComment: $HOSTACKCOMMENT$\n" | /usr/bin/mail -s "* $NOTIFICATIONTYPE$ alert $NOTIFICATIONNUMBER$ - $HOSTALIAS$ host is $HOSTSTA
TE$ **” $CONTACTEMAIL$
}

‘notify-by-email’ command definition

define command{
command_name notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios \n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState: $SERVICESTATE$ for $SERVICEDURATION$\nAddress: $HOSTADDRESS$\n\nInfo:\n\n$SERVICEOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nACK by: $SERVICEACKAUTHOR$\nComment: $SERVICEACKCOMMENT$\n" | /usr/bin/mail -s "* $NOTIFICATIONTYPE$ alert $NOTIFICATIONNUMBER$ - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}

I have bolded and underlined the parts you got to have in this configuration so the Acknoledgement info could be visible in the email.


#3

That didnt work, but thanks for the help. If anyone has another solution, please let me know.


#4

Looking at the most recent macro documentation, those underlined macros are deprecated:
[blockquote]8 These acknowledgement macros are deprecated. Use the more generic $NOTIFICATIONAUTHOR$, $NOTIFICATIONAUTHORNAME$, $NOTIFICATIONAUTHORALIAS$ or $NOTIFICATIONAUTHORCOMMENT$ macros instead.
[/blockquote]
You may find that (if applicable) on your nagios server’s documentation, under ‘the basics/Standard macros available in Nagios’. I should point out that I’m using 3.0rc2. If you are as well, I reckon you should try using

ACK by: $NOTIFICATIONAUTHOR$\nComment: $NOTIFICATIONAUTHORCOMMENT$\n

instead in both cases. Also, I would point out that in this version the notify command_names are different to those posted by Albin…

command_name notify-host-by-email command_name notify-service-by-email
Be sure you are changing the actual command you are using.

HTH

/S


#5

Thanks for the responses. Sorry all im a little new to Nagios. Here are my entries, can you tell me where im going wrong? Thanks alot!

‘host-notify-by-email’ command definition

define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios 2.10 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nACK by: $NOTIFICATIONAUTHOR$\nComment: $NOTIFICATIONAUTHORCOMMENT$\n” | /bin/mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}

‘notify-by-email’ command definition

define command{
command_name notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios 2.10 ***\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}


#6

As you are using 2.10 I don’t know which version of the macros apply in your case, but I would think probably Albin’s post is applicable as the answer you are looking for. I’m afraid I don’t have 2.10 here so if that doesn’t work for you hopefully someone else using 2.10 can come up with something useful.
[Edit: Just to confirm, nagios will need a restart after the changes are made…]


#7

Thanks Strides, but as i posted on 2/28, his solution didnt work. The acknowledgement comments didnt show up in the emails.