We have 3 templates for services, low-priority
, high-priorty
and medium-priorty
. Low priority services are attached to the contactgroup low
, medium priorty services are attached to the contact group medium
and high priority (OK you probably get the idea).
Low priority services don't notify, medium priority alerts notify by email and high priority alerts notify by email and phone. Except they don't (yet)
What I need to do is specify that any alerts generated by high-priorty
services should run the notification commands notify-service-by-email
and notify-service-by-phone
. From reading the documentation (and my knowledge of Nagios) the only way I know to set notification commands is the service_notification_commands
option in a contact, but that would mean each contact would need two definitions, one for phone and one for email. How would I get high-priority
services to call the notify-service-by-phone
command?
More info;
Service Templates
;High priority service (Alert by call, 1 min check period)
define service{
name high-priority-service
notifications_enabled 1
normal_check_interval 1
contact_groups high
use generic-service
register 0
}
;Med priority service (Alert by email, 5 min check period)
define service{
name med-priority-service
notifications_enabled 1
normal_check_interval 5
contact_groups medium
use generic-service
register 0
}
;Low priority service (No alert, 10 min check period)
define service{
name low-priority-service
normal_check_interval 10
use generic-service
register 0
}
(generic-service
is the default template from NAGIOS configs with a few tweaks)
Services
define service{
use high-priority-service
hostgroup_name generic-server-nrpe
service_description SSH
check_command check_ssh
}
Contact groups
define contactgroup{
contactgroup_name low
alias Low Priority Notifications
members sam,[...]
}
define contactgroup{
contactgroup_name medium
alias Medium Priority Notifications
members sam,[...]
}
define contactgroup{
contactgroup_name high
alias High Priority Notifications
members sam,[...]
}
Contacts
define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0
}
define contact{
contact_name sam
use generic-contact
alias Sam
email sam[...]
address1 +44[...]
}
It seems that you need to define your contacts twice. One definition to be notified only by email and another definition to be notified by both email and phone.
Your contacts should be defined according to these two types of contacts: