Import Config Files| Doesn't Remove Services

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
jamie87
Posts: 9
Joined: Thu Jul 11, 2024 9:18 am

Import Config Files| Doesn't Remove Services

Post by jamie87 »

Hi,

I am having an issie making changes to config via the Import Config File.

I initially wrote a script to generate host/service config files and import them using the XI API, this works great for creating the host and services however if i then update the config file, say for example removing a service from the cfg file and put it in the import folder.

Upon import, i can see the import took place via Config Snapshots however it doesn't show any differences and the service i removed remains active, if i then check the file in etc/services/<sever_name>.cfg and can see the service i expected to be removed is still there.

I thought maybe my script wasn't doing something correctly so to test it i manually created the updated cfg file in the import folder and ran the import through the XI UI Import screen, again this process appeared to work without error but the service continued to remain.

Is it possible to remove a service through importing a config file or is that only for creating?

Regards,
Jamie
kg2857
Posts: 490
Joined: Wed Apr 12, 2023 5:48 pm

Re: Import Config Files| Doesn't Remove Services

Post by kg2857 »

Not sure but maybe this will help...
https://answerhub.nagios.com/support/s/ ... I-4a9fc528
I think you can disable hosts via an import but I looked and it doesn't seem to be defined in the cfg file definition for hosts.
BTW, I used to import configs simply by copying them to the import dir and running the reconfigure script. This needs to be done in order so you don't import something such as a template for example before the template is defined, but it worked great for building lots of nagios systems.
jamie87
Posts: 9
Joined: Thu Jul 11, 2024 9:18 am

Re: Import Config Files| Doesn't Remove Services

Post by jamie87 »

Thank you for the reply, i was looking at the API as an alternative and earlier this morning i came across this post viewtopic.php?p=95772#p95772 which states:
You cannot remove a service in Nagios XI by simply modifying the config file manually from the CLI. The config info is still in the database. You need to remove the service via the Core Config Manager, save the changes, and Apply Configuration.
Not sure if this refers to the import process too but i decided to give the API method a shot as importing was looking less like an option and that worked great so will go with the API option.

Thank you.
Post Reply