Page 1 of 1

Possible to 2 notifications

Posted: Wed Nov 06, 2013 9:11 pm
by cesar.garza
Hey people
I need your suggestion. I have setup a notification service by phone and getting the calls whenever services or hosts go down. But there is a twist that we are getting calls for recovery services/hosts too that we don't want it. But we want the emails for recovery services/host only.
However if I remove the "" r "" option from the notification (template.cfg), this will not call for recovery service but will not send email too. Any suggestion would be appreciated.
Thanks

Code: Select all

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-phone
        host_notification_commands      notify-host-by-phone 
        register                        0                    
        }

Re: Possible to 2 notifications

Posted: Thu Nov 07, 2013 9:19 am
by cbeattie
You may need two separate contacts in Nagios for each real person: one with an e-mail address that receives all notifications and one with a phone address that doesn't receive recovery notifications.

Code: Select all

    define contact{
            name                            generic-contact-mail
            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-mail
            host_notification_commands      notify-host-by-mail
            register                        0
            }

    define contact{
            name                            generic-contact-phone
            service_notification_period     24x7
            host_notification_period        24x7
            service_notification_options    w,u,c,f,s
            host_notification_options       d,u,f,s
            service_notification_commands   notify-service-by-phone
            host_notification_commands      notify-host-by-phone
            register                        0
            }


Re: Possible to 2 notifications

Posted: Thu Nov 07, 2013 10:04 am
by tmcdonald
Did this fix the issue you were having, cesar.garza?

Re: Possible to 2 notifications

Posted: Thu Nov 07, 2013 12:51 pm
by cesar.garza
cbeattie wrote:You may need two separate contacts in Nagios for each real person: one with an e-mail address that receives all notifications and one with a phone address that doesn't receive recovery notifications.

Code: Select all

    define contact{
            name                            generic-contact-mail
            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-mail
            host_notification_commands      notify-host-by-mail
            register                        0
            }

    define contact{
            name                            generic-contact-phone
            service_notification_period     24x7
            host_notification_period        24x7
            service_notification_options    w,u,c,f,s
            host_notification_options       d,u,f,s
            service_notification_commands   notify-service-by-phone
            host_notification_commands      notify-host-by-phone
            register                        0
            }


I made the changes in template.cfg and tried but i got the call but not RECOVERY email. I have attached the screenshot for your reference.

Re: Possible to 2 notifications

Posted: Thu Nov 07, 2013 1:09 pm
by cbeattie
You have two templates, but do you also have two contacts defined using those templates?

For example:

Code: Select all

define contact {
	name cesar-phone
	use generic-contact
	contactgroups support
	pager xxxxx
}

define contact {
	name cesar-email
	use generic-contact-email
	contactgroups support
	email [email protected]
}
And both contacts are set to receive notifications from those hosts and services? It could be either by being directly assigned or as a member of the "support" contactgroup in the example.

Re: Possible to 2 notifications

Posted: Thu Nov 07, 2013 2:11 pm
by cesar.garza
cbeattie wrote:You have two templates, but do you also have two contacts defined using those templates?

For example:

Code: Select all

define contact {
	name cesar-phone
	use generic-contact
	contactgroups support
	pager xxxxx
}

define contact {
	name cesar-email
	use generic-contact-email
	contactgroups support
	email [email protected]
}
And both contacts are set to receive notifications from those hosts and services? It could be either by being directly assigned or as a member of the "support" contactgroup in the example.

So now i have made the new contact but still not able to receive RECOVERY emails. my templates are still same like above

Re: Possible to 2 notifications

Posted: Thu Nov 07, 2013 2:34 pm
by slansing
Can you manually define the recovery definitions in that contact and try using it without a template? Also, what do your host/service notification options look like in the actual host/service definition?

Re: Possible to 2 notifications

Posted: Thu Nov 07, 2013 3:15 pm
by cesar.garza
slansing wrote:Can you manually define the recovery definitions in that contact and try using it without a template? Also, what do your host/service notification options look like in the actual host/service definition?
You know what whatever you told me to make a change, i did and its working now BUT if i put notification option only "" r "" it doesn't work but if i add any other option "" f "" it works. Weird thing. its okay to keep both option for me so thats fine.
Thanks for your help. :)