send service alert using two different service templates

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jh129666
Posts: 98
Joined: Mon Feb 11, 2013 3:45 pm

send service alert using two different service templates

Post 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
}
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: send service alert using two different service templates

Post 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.
Former Nagios employee
https://www.mcapra.com/
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: send service alert using two different service templates

Post by scottwilkerson »

Escalations are really the only way to send notification for different states to different contacts.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked