Page 1 of 1

Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 11:43 am
by jkinning
I have several, hundreds, of Contacts that don't have the host|service_notifications_enabled set to 1 (on). Is there a way within the UI to change all the Contacts to have the Host and Services notifications to enabled?

Maybe I am not understanding this but if I have a Host and/or Services checks and have a specific contact(s) assigned either individually or within a Contact Group will they still receive the notifications or does this setting need set?

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 12:23 pm
by lmiltchev
I have several, hundreds, of Contacts that don't have the host|service_notifications_enabled set to 1 (on).
How did you create these contacts? Did you create them by going to "CCM->Contacts->Add New" or by going to "Admin->Manage Users->Add New User"?

If you are having issues with notifications, I would recommend sending your profile to [email protected].

Admin->System Profile->Download Profile

This way we can review all of your configs.

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 12:40 pm
by jkinning
I used CCM->Contacts->Add New and then created config files and placed them into the Import directory.

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 1:00 pm
by lmiltchev
Do you have a template assigned to these contacts? If you do, you could enable notifications in the template these contacts are using.

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 1:19 pm
by jkinning
No, because I never quite understood how they work. If I use a contact template does that override the other settings or do I just forget about setting the other settings on the contact and the template manages those. Setting I am referring to the host and service_notification_commands and periods.

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 1:28 pm
by ssax
You set the settings in the template so you don't have to define them on the contact, if it's defined on the contact it will override the template. Locally defined things always override the templates.

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 1:33 pm
by lmiltchev
A template won't override settings on a host/service level. It is the other way around. "Local" object variables always take precedence over variables defined in the template object. For more information on the topic, please review the document below:

https://assets.nagios.com/downloads/nag ... tance.html

You can set up a contact template with host/service notifications enabled:

Code: Select all

host_notifications_enabled    		1
service_notifications_enabled 		1
Copy the "/usr/local/nagios/etc/contacts.cfg" file to the "/usr/local/nagios/etc/import/" directory. Modify the file by adding the template to your contacts, save, exit, and run reconfigure_nagios.sh.

Code: Select all

cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
As always, it's is a good idea to create backups/snapshots, etc. prior to making big changes. :)

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 2:23 pm
by jkinning
Thanks for the template idea and link.

I ended up deleting all the contacts I had and then created new cfg files with the use <template> and tossed them in the import directory. Clicked Applied Configuration and they are all there using the template. Brilliant!

Close at your convenience.

Re: Bulk Modifications for Contacts

Posted: Wed Jul 22, 2015 2:25 pm
by lmiltchev
I am glad I could help! I am locking this thread.