Host/service acknowledgement template?

Russell Jackson raj at csub.edu
Mon Sep 17 21:31:52 CEST 2007


Boeckman, Matthew wrote:
> Hello list!
> 
> Is there a way to configure a custom notification email for
> acknowledgements? What I have currently is a lightly modified version of
> notify-host-by-email and notify-service-by-email to include the ACK
> macro's:
> 
> define command{
>         command_name    notify-host-by-email
>         command_line    /usr/bin/printf "%b" "***** Nagios
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
> $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\n
> $HOSTACKAUTHOR$ ack'd the alarm with message
> $HOSTACKCOMMENT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "**
> $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **"
> $CONTACTEMAIL$
>         }
> 
> This works, but of course my text "ack'd the alarm with message" appears
> in all types of notifications with nothing in the macro fields, and for
> ACK's it works just fine. 
> 
> I'm wondering if there is something do-able like notify-ack-by-email
> that would only function on NOTIFICATIONTYPE=ACKNOWLEDGEMENT and thus
> use a specific printf statement about the ack. I see how I could
> configure another command definition and include it, but I'm not clear
> how to do the IF-THEN type logic. 
> 
> Any pointers are appreciated, thanks!
> 

I use an external sh script (see attachment). It's called without arguments (taking
advantage of nagios 2.x exporting of macros to the environment) like so:

define command {
	command_name notify-by-email
	command_line $USER3$/notify-by-email.sh
}

I use the same script for all notification and generate the contents based on the presence
of certain macros -> env variables. The script could probably be better, but it's working
for me ATM.

-- 
Russell A. Jackson <raj at csub.edu>
Network Analyst
California State University, Bakersfield

Don't make a big deal out of everything; just deal with everything.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: notify-by-email.sh
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070917/95f3a997/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3750 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070917/95f3a997/attachment.bin>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list