deleting host without using GUI and Nagios XI API

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
breddymd0034
Posts: 5
Joined: Fri May 29, 2020 9:55 am

deleting host without using GUI and Nagios XI API

Post by breddymd0034 »

Hi,

As part of my project, i need to delete hosts without using nagios XI GUI and API.

so I have deleted a existing host (host1.cfg) config file from /usr/local/nagios/etc/hosts/host1.cfg

But same host is re-created when i run $/usr/local/nagiosxi/scripts/reconfigure_nagios.sh

Please help on
a) why reconfigure_nagios.sh script re-creating deleted host ? or
b) How can i delete host without using GUI and APIs ?

Thanks,
Bhaskar
User avatar
jbrunkow
Posts: 441
Joined: Fri Mar 13, 2020 10:45 am

Re: delete host without using GUI and API

Post by jbrunkow »

You should not manually delete/modify files under /usr/local/nagios/etc/hosts or /usr/local/nagios/etc/services (unless it's in /usr/local/nagios/etc/static) as it will interfere with the functionality of the system.

The CCM is the database, when you apply configuration the CCM writes out the changes from the DB to the filesystem and then restart the nagios service to pick up those changes to make them active.

All an apply config does is this:

Code: Select all

cd /usr/local/nagiosxi/scripts && ./reconfigure_nagios.sh
Which is writing out the changes to disk (which is why your host being recreated).

You will need to use the API or delete them from the CCM manually so that the relationships can be handled properly (so you don't have an invalid config), otherwise you can define them in /usr/local/nagios/etc/static if you want to manually manage the configs (but you won't be able to see them in the CCM to modify them).
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
breddymd0034
Posts: 5
Joined: Fri May 29, 2020 9:55 am

Re: deleting host without using GUI and Nagios XI API

Post by breddymd0034 »

Thank you Jbrukow for the response and suggestions.
Please close this.

Thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: deleting host without using GUI and Nagios XI API

Post by scottwilkerson »

breddymd0034 wrote:Thank you Jbrukow for the response and suggestions.
Please close this.

Thanks
Great!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked