Page 1 of 1

send service alert using two different service templates

Posted: Tue Jan 15, 2019 11:03 pm
by jh129666
I have the below service templates defined, and I would like to use both of them for the same service. The first one would be used for a status of critical and the second one would be used for a status of warning. I also included the service definition.

Is it possible to do this, and if so, how would I set it up?


define service {
name nrpe_db_service_prod_critical
check_command check_nrpe!!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 0
notification_period 24x7-Prod
notification_options c,
notifications_enabled 1
contact_groups dbas_service_prod_critical
register 0
}

define service {
name nrpe_db_service_prod_warning
check_command check_nrpe!!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period 24x7-Prod
notification_options w,
notifications_enabled 1
contact_groups dbas_service_prod_warning
register 0
}

define service {
host_name adcdeXXX
service_description DB tablespace
use nrpe_db_service_prod_warning
check_command check_nrpe!check_tablespace!-a 'xxxxx3'!!!!!!
contact_groups +dbas_service_prod_critical
_graphiteprefix nagios.perfdata
_xiwizard nrpe
register 1
}

Re: send service alert using two different service templates

Posted: Wed Jan 16, 2019 12:02 pm
by mcapra
Are escalations able to satisfy your use case?
https://assets.nagios.com/downloads/nag ... ations.pdf

Under a serviceescalation object:
escalation_options: This directive is used to define the criteria that determine when this service escalation is used. The escalation is used only if the service is in one of the states specified in this directive. If this directive is not specified in a service escalation, the escalation is considered to be valid during all service states. Valid options are a combination of one or more of the following: r = escalate on an OK (recovery) state, w = escalate on a WARNING state, u = escalate on an UNKNOWN state, and c = escalate on a CRITICAL state. Example: If you specify w in this field, the escalation will only be used if the service is in a WARNING state.
That would be how I'd rig it up. You'd have your dbas_service_prod_warning contactgroup be responsible for the default notifications on the service, then escalate to dbas_service_prod_critical specifically on critical notifications.

Re: send service alert using two different service templates

Posted: Wed Jan 16, 2019 3:43 pm
by scottwilkerson
Escalations are really the only way to send notification for different states to different contacts.