Need a way to update config based on current contact group

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
OUberLord
Posts: 17
Joined: Wed Mar 25, 2015 8:31 am

Need a way to update config based on current contact group

Post by OUberLord »

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?
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Need a way to update config based on current contact gro

Post by pbroste »

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.

Code: Select all

grep -Eir 'GroupA' --color=always /usr/local/nagios/etc/*.cfg
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.

Code: Select all

sed -i 's/GroupA/GroupB/g' your.cfg's
Once that has been completed and placed into the import directory you can then pull the trigger.

Thanks,
Perry
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Need a way to update config based on current contact gro

Post by ssax »

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.
Locked