Page 1 of 1

How do i add the acknowledge username to email notifications

Posted: Thu Jan 03, 2013 3:34 pm
by dennis.kn
Hello,

I'm trying to add the user name of the person acknowledging a service check. Right now if you acknowledge a check you get a email like this:

From: [email protected] [mailto:[email protected]]
Sent: Thursday, January 03, 2013 12:32 PM
To: Me
Subject: ACKNOWLEDGEMENT:Server-name/Ping Check is CRITICAL

T:Thu Jan 3 12:31:43 EST 2013
I:PING CRITICAL - Packet loss = 100%

I want it changed to add the last line:

From: [email protected] [mailto:[email protected]]
Sent: Thursday, January 03, 2013 12:32 PM
To: Me
Subject: ACKNOWLEDGEMENT:Server-name/Ping Check is CRITICAL

T:Thu Jan 3 12:31:43 EST 2013
I:PING CRITICAL - Packet loss = 100%
ACK by:User-acknowledging-this-check

In my /etc/nagio/commands.cfg i have:

define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "T:$LONGDATETIME$\nI:$SERVICEOUTPUT$" | /bin/mail -s "$NOTIFICATIONTYPE$:$HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$
}

What would I add or am i looking in the wrong place?

Dennis

Re: How do i add the acknowledge username to email notificat

Posted: Sun Jan 06, 2013 5:01 pm
by jsmurphy
Here's a list of the macros available in Nagios: http://nagios.sourceforge.net/docs/3_0/macrolist.html

The ones you are probably looking for are:
$SERVICEACKAUTHOR$
$HOSTACKAUTHOR$

As an example you would update it like:
define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "T:$LONGDATETIME$\nI:$SERVICEOUTPUT$\nACK by:$SERVICEACKAUTHOR$" | /bin/mail -s "$NOTIFICATIONTYPE$:$HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$
}

Re: How do i add the acknowledge username to email notificat

Posted: Mon Jan 07, 2013 8:47 am
by dennis.kn
jsmurphy,

You are the man! Thanks for the great answer, for showing me where to look( I feel so dumb for missing that) and an example on what to do. That made it really easy to update and test and also show me a little more of what Nagios could do.

If i could rate this you would got 5 out of 5 stars,
if i could like this I would!
:D