Manipulation of email notifications

Tedman Eng teng at dataway.com
Wed Nov 30 19:46:08 CET 2005


Replace the "one-liner" notification command with an external script.  This
will let you include any sort of logic you'd like in the script.
Pass the nagios variables to the script as arguments.


define command{
        command_name    notify-by-email
        command_line    alert-email.sh $NOTIFICATIONTYPE$ $SERVICEDESC$
$SERVICEACKCOMMENT$...
}




-----Original Message-----
From: Deborah Martin [mailto:Deborah.Martin at Kognitio.com]
Sent: Wednesday, November 30, 2005 2:04 AM
To: 'nagios-users at lists.sourceforge.net'
Subject: [Nagios-users] Manipulation of email notifications


Hi, 

Is there a way to manipulate the content of an email by type of email
notification ? For example, if I acknowledge a Critical alert with the text
'Under Investigation', I want to include that text in the 
email notification. However, if I receive a recovery notification I don't
need to have the acknowledgement text included. 

I've configured the following in miscommands.cfg 

# '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$\nAddress: $HOSTADDRESS$\nState:
$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
Info:\n\n$SERVICEOUTPUT$\nAcknowledgements: $SERVICEACKCOMMENT$" |
/usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is
$SERVICESTATE$ **" $CONTACTEMAIL$
        }

But I do not want ` \nAcknowledgements: $SERVICEACKCOMMENT$ ` on Recovery
alerts. The alternative would be to have a default value set of N/A which is
overridden with a value if an acknowledgement
has been set but I don't see an easy way to do this either. 

Does anyone have any ideas if it can be done (and how) or that it can't be
done like this ? 

thanks,

deborah 

************************************************************************ 
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. Any unauthorised distribution or copying is strictly 
prohibited. 
Whilst Kognitio Limited takes steps to prevent the transmission of 
viruses via e-mail, we can not guarantee that any email or 
attachment is free from computer viruses and you are strongly 
advised to undertake your own anti-virus precautions. 
Kognitio grants no warranties regarding performance, 
use or quality of any e-mail or attachment and undertakes no 
liability for loss or damage, howsoever caused. 
*********************************************************************** 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
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