Hey all,
I am trying to come up with a way to update existing hosts and services to have a new contact group, and ideally remove the existing one, based on if they are tied to a certain contact group now.
For example, initially we created a contact group named GroupA, and used it as the contact group for some (but not all) of our hosts and groups that were tied to that group of people. We made GroupB and added the contacts we want to it, and don't want to use GroupA any more.
What would the easiest way be to find all hosts and services that are currently using GroupA as their contact group for notifications, and set them to use GroupB instead?
Need a way to update config based on current contact group
Re: Need a way to update config based on current contact gro
Hello @OUBerLord,
Here is an overview to start and then we can dial things in as you go along.
You will want to get a list of GroupA so you make the necessary adjustments to the cfg's.
Once you get a list and you figure out which one's will get 'GroupB' then you can run something like this simple example or create a script that finds and replace.
Once that has been completed and placed into the import directory you can then pull the trigger.
Thanks,
Perry
Here is an overview to start and then we can dial things in as you go along.
You will want to get a list of GroupA so you make the necessary adjustments to the cfg's.
Code: Select all
grep -Eir 'GroupA' --color=always /usr/local/nagios/etc/*.cfgCode: Select all
sed -i 's/GroupA/GroupB/g' your.cfg'sThanks,
Perry
Re: Need a way to update config based on current contact gro
You can also just go to Configure > Core Config Manager > Contact Groups and click the little blue circle with the letter i in it to see the contact group's current relationships.
If you have the Enterprise License addon you can also use Configure > Core Config Manager > Bulk Modifications Tool > Remove a contactgroup > Find Relationships, note them, then use Configure > Core Config Manager > Bulk Modifications Tool > Add a contactgroup.
If you have the Enterprise License addon you can also use Configure > Core Config Manager > Bulk Modifications Tool > Remove a contactgroup > Find Relationships, note them, then use Configure > Core Config Manager > Bulk Modifications Tool > Add a contactgroup.