Hello,
I have a need to remove all "service group" configs from several services - about 800 of them. I don't want these services to be a part of any service group. Rather than using the GUI to do this, I'd like modify a list of cfg files, and then use the import function. The steps that I'm taking:
1. Copy /usr/local/nagios/etc/services/host.cfg to my local computer
2. Remove all "servicegroup" lines
3. Upload new config to /usr/local/nagios/etc/import/host.cfg
4. In Nagios CCM, import /usr/local/nagios/etc/import/host.cfg
5. Write configs to file/Verify/Apply
The problem I'm having is that the import seems to be additive - after the import the previously configured service group remains in the database. I can use the import to change the configuration (i.e.: change servicegroup from A to B), but not remove it. The "overwrite database" box is checked. Is this by design?
Thanks
Using the import function to remove config items
-
crystal.then
- Posts: 57
- Joined: Mon Oct 27, 2014 12:05 am
Re: Using the import function to remove config items
What is the version of Nagios XI that you are currently using?
I was not able to recreate your issue on 2014R2.7. After replacing servicesgroup A with servicegroup B in the service config, moving it to the "import" directory and running "reconfigure_nagios.sh", I can see only servicegroup B in the service definition.The problem I'm having is that the import seems to be additive - after the import the previously configured service group remains in the database.
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
crystal.then
- Posts: 57
- Joined: Mon Oct 27, 2014 12:05 am
Re: Using the import function to remove config items
We're running Nagios XI 2014R2.7.
I'm also able to replace service group A with service group B. The issue is that I need to remove the service groups completely - so import a zero or null value for service groups.
I'm also able to replace service group A with service group B. The issue is that I need to remove the service groups completely - so import a zero or null value for service groups.
Re: Using the import function to remove config items
You are correct - you cannot remove the service group completely - not using this method anyway. There is a "workaround" that you can use in order to remove all servicegroups from a service in the CLI. You can do the following:
1. Copy your service config to "/tmp/"
2. Delete the service completely.
For more info about managing host/services from the command line, see this document:
https://assets.nagios.com/downloads/nag ... gement.pdf
3. Modify the config that you saved in "/tmp/" directory by deleting the "servicegroups" directive from your service. Delete the whole line:
4. Move the config to the "import" directory and run "reconfigure":
1. Copy your service config to "/tmp/"
Code: Select all
cp /usr/local/nagios/etc/services/<service config>.cfg /tmp/Code: Select all
cd /usr/local/nagiosxi/scripts
./nagiosql_delete_service.php --config=<service config>
./reconfigure_nagios.shhttps://assets.nagios.com/downloads/nag ... gement.pdf
3. Modify the config that you saved in "/tmp/" directory by deleting the "servicegroups" directive from your service. Delete the whole line:
Code: Select all
servicegroups servicegroup_namesCode: Select all
mv /tmp/<service config>.cfg /usr/local/nagios/etc/import
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.shBe sure to check out our Knowledgebase for helpful articles and solutions!
-
crystal.then
- Posts: 57
- Joined: Mon Oct 27, 2014 12:05 am
Re: Using the import function to remove config items
Thanks lmiltchev - this works a treat!
Re: Using the import function to remove config items
I am glad I could help! 
Be sure to check out our Knowledgebase for helpful articles and solutions!