Page 1 of 1

deleting host without using GUI and Nagios XI API

Posted: Wed Jul 01, 2020 10:04 am
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

Re: delete host without using GUI and API

Posted: Wed Jul 01, 2020 3:20 pm
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).

Re: deleting host without using GUI and Nagios XI API

Posted: Thu Jul 02, 2020 2:16 pm
by breddymd0034
Thank you Jbrukow for the response and suggestions.
Please close this.

Thanks

Re: deleting host without using GUI and Nagios XI API

Posted: Mon Jul 06, 2020 3:04 pm
by scottwilkerson
breddymd0034 wrote:Thank you Jbrukow for the response and suggestions.
Please close this.

Thanks
Great!

Locking thread