Can I split Alerts in a config file?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
joe1871
Posts: 28
Joined: Tue Feb 01, 2011 3:36 pm

Can I split Alerts in a config file?

Post by joe1871 »

Hi,

I would like to send alerts for some monitors to two different email addresses depending on whether the alert is a warning or a critical. We use an email account for our paging system, and don't want to get people out of bed if the issue is only a warning. Can I make two sets of conditions in a contact template where the "w" goes to one contact and the "c" goes to another? For example:

normal_check_interval 15 ; Check the service every 15 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every ONE minutes until a hard state can be determined
contact_groups email#1 ; page for critical
notification_options c ; Send notifications about critical
contact_groups email #2 ; warning Notifications get sent out to everyone in the 'email2' group
notification_options w,u,r ; Send notifications about warning, unknown,recovery
notification_interval 60 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!

Is this an OK way to do this, or should I have separate templates for each condition? Will the above do what it is intended to do?

Thanks

Joe
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Can I split Alerts in a config file?

Post by hsmith »

Make two contacts. Set those two contacts to be in the same contact group. Use that contact group for the service/host in question. Have one contact only critical emails, have the other receive warning and critical?

https://assets.nagios.com/downloads/nag ... ml#contact

That's the most simple way I can think to do it.
Former Nagios Employee.
me.
Locked