Different contact commands for different states?

Marc Powell marc at ena.com
Mon Sep 20 23:02:01 CEST 2004


jeff vier <> wrote:
> Can I do either differing contact definitions (one for Recovery, one
> for 
> problems) or some kind of if-statement in the misccommands?
> (I know, wishful thinking with the latter).
> 
> I'm running v2.0a, if that matters.
> 
> In case you're curious as to why I want such a thing, I'm sending an
> Acknowledgment link with my alerts, but another thread (Andreas
> talking about patching in similar functionality) got me thinking -
> how can I not send the Ack link on Recovery (since it doesn't really
> do anything)?    

You could do either.

A) Differing Contacts
	Create two contacts per person, one that receives Down/Critical
and the other that receives Recoveries. The Down/Critical contact uses
the notification command
service-notify-by-email-ack/host-notify-by-email-ack, which is the
command you are currently using that includes your ACK link. The
Recovery contact uses the notification command
service-notfy-by-email-no-ack/host-notify-by-email-no-ack that is the
same as above but without the ack link included.

define contact{
        contact_name                    nateng-servers-ack
        alias                           Servers On Call
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    c
        host_notification_options       d
        service_notification_commands   service-notify-by-email-ack
        host_notification_commands      host-notify-by-email-ack
        email                           marc at ena.com
        }
define contact{
        contact_name                    nateng-servers-no-ack
        alias                           Servers On Call - NO ACK
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    r
        host_notification_options       r
        service_notification_commands   service-notify-by-email-no-ack
        host_notification_commands      host-notify-by-email-no-ack
        email                           marc at ena.com
        }

# 'nateng-oncall-servers' contact group definition
define contactgroup{
        contactgroup_name       nateng-oncall-servers
        alias                   ENA NETWORK NOTIFIES
        members                 nateng-servers-ack,nateng-servers-no-ack
        }

I'd include an example command definition for each of the above but I'm
not sure exactly how you're including the ACK link but you get the
picture. This means of course that depending on how you set up your
notification schema, you could end up with a lot of mostly duplicated
contact definitions.

B) Notification logic
 	The example *-notify-by-email commands are just a really long,
non-intelligent echo statement sending it's output to /bin/mail(x). You
could either replace the echo part with a shell/perl script that you
write that has the logic you need and prints to standard out whatever
you want mailed or replace the entire thing with the same script that
also handles the mail part as well. That way, you can include whatever
logic you want and whatever additional information you do or do not want
based on any of the macros available to notifications or your own
external data sources.

--
Marc


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
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