Possible to 2 notifications

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
cesar.garza
Posts: 80
Joined: Mon Aug 19, 2013 3:14 pm

Possible to 2 notifications

Post 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                    
        }
cbeattie
Posts: 19
Joined: Fri Oct 04, 2013 7:12 am

Re: Possible to 2 notifications

Post 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
            }

tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Possible to 2 notifications

Post by tmcdonald »

Did this fix the issue you were having, cesar.garza?
Former Nagios employee
cesar.garza
Posts: 80
Joined: Mon Aug 19, 2013 3:14 pm

Re: Possible to 2 notifications

Post 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.
Attachments
1.jpg
cbeattie
Posts: 19
Joined: Fri Oct 04, 2013 7:12 am

Re: Possible to 2 notifications

Post 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.
cesar.garza
Posts: 80
Joined: Mon Aug 19, 2013 3:14 pm

Re: Possible to 2 notifications

Post 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
Attachments
2-1.jpg
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Possible to 2 notifications

Post 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?
cesar.garza
Posts: 80
Joined: Mon Aug 19, 2013 3:14 pm

Re: Possible to 2 notifications

Post 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. :)
Locked