Different contact on WARNING and CRITICAL


#1

I’m wondering if it’s possible to have different contacts when an alert is WARNING and when it is CRITICAL.
An example:

Service ABC - WARNING -> someperson@somemail.org
Service ABC - CRITICAL -> somepager@somepagergateway.org

I can’t get this right. If you need me to clarify, please write in the thread.

Regards
Dag Stockstad


#2

Hi

Set the service_notification_options in the contact’s command object as appropriate for each contact…

nagios.sourceforge.net/docs/3_0/ … ml#contact

So, somepager will not have the w, just the c… someperson will have w and c

HTH

/S


#3

Thanks a lot.

Regards
Dag


#4

We’re having problems with multiple recoveries being sent out.

[code]define contact {
contact_name mail_crit
use generic-contact
service_notification_options c,r
alias Mail
email email@mail
}

define contact {
contact_name mail_warn
use generic-contact
alias Mail
service_notification_options w,u,r
email email@mail
}

define contact {
contact_name pagerday_crit
use day-contact
alias Pager Day
email pager@gateway
service_notification_options c,r
service_notification_commands notify-service-by-pager
host_notification_commands notify-host-by-pager
}

define contact {
contact_name pagernight_crit
use night-contact
alias Pager Night
email pager@gateway
service_notification_options c,r
service_notification_commands notify-service-by-pager
host_notification_commands notify-host-by-pager
}
[/code]

Is it impossible to use recoveries with this kind of setup or is there a way to keep track when a service goes from WARNING -> RECOVERY and CRITICAL -> RECOVERY?


#5

Erk, don’t think so… think a recovery is a recovery, like it doesn’t discern between warning->recovery and critical->recovery, just that it’s a recovery. Maybe there might be a way of using the macro

but you would probably have to do something along the lines of creating recovery-only contacts i.e.

define contact { contact_name pagerday_recov use day-contact alias Pager Day email pager@gateway service_notification_options r service_notification_commands notify-service-by-pager-recov host_notification_commands notify-host-by-pager-recov }
then create your notify-x-by-pager-recov in command.cfg and get it to pass accross everything as per usual (i.e. all the normal information you want in your notification - hostname, service, state, contact address etc) but also the $LASTSERVICESTATE$ macro, into an external script.
Your external script would then have to assess whether the content of the $LASTSERVICESTATE$ macro was valid to generate a recovery message for this contact, i.e. in the case of pagerday_recov one assumes that it would have to be CRITICAL in order to send the notification, not WARNING. Then, should it be appropriate for the case in hand, get your script to handle the generation of the notification in much the same way as nagios would.

It sounds a bit horrific to me :roll:

HTH

/S