On Tue, 17 Jun 2008 17:47:17 +0200
Wim De Geeter <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a small question. Is it possible to use different email
> templates for notification. One for warning and critical and another
> one for recovery.
Short answer: yes.
How would you do it? As follows:
When nagios calls the alert program, it passes a number of
parameters. One of these $NOTIFICATIONTYPE$ is described as follows in
the docs:
Notification Macros:
$NOTIFICATIONTYPE$ A string identifying the type of
notification that is being sent ("PROBLEM", "RECOVERY",
"ACKNOWLEDGEMENT", "FLAPPINGSTART" or "FLAPPINGSTOP").
Knowing this, you could write your own script in bash/python/etc. that
could be called as follows:
/usr/local/bin/alertscript.sh $NOTIFICATIONTYPE$ $HOSTNAME$ $MORE$
$MACROS$ $HERE$
In the script you could then check for the first argument and
depending on the value, send the appropriate email.
Personally, I have two templates for emails - Hosts and services - that
have tags in them similar to html such as <hostname> and
<servicename>. I have a python script that is called by nagios in the
event of an alert and this script reads in the alert type
(host/service) and uses the appropriate template accordingly - there's
no reason why you couldn't do something similar based on the
notification type.
Hope this helps,
Matt
--
Matthew Macdonald-Wallace
[EMAIL PROTECTED]
http://www.truthisfreedom.org.uk
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nagios-users mailing list
[email protected]
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