NagiosXI 5.2.7
RHEL 6.7
To make a change to an XI config file I pull it into <nagios>/etc/import/, make the modification, then run <nagiosxi>/scripts/reconfigure_nagios
I've configured hosts, hostgroups, contacts, templates, and services this way.
Recently I've been coming across things that I *can't configure like this.
For example: a contact_group that was added to a service via the web interface
I pulled the service cfg into <nagios>/etc/import, removed the line, ran <nagiosxi>/scripts/reconfigure_nagios ...
when I looked at the <nagios>/services/ cfg, the contact_group line that I had just removed was back.
I pulled the service cfg into <nagios>/etc/import, added a contact, ran <nagiosxi>/scripts/reconfigure_nagios to verify I could make a change ...
when I looked at the <nagios>/services/ cfg the addition I made was there.
After removing the problematic contact_groups line via the web gui I was then able to add or remove the line via cli/reconfig.
(oh ... I also found I could add to that contact_group line ... just not remove it or the group that was added via the web gui)
I came across similar behavior with contacts.cfg where changes made via the web interface 'stuck' even if the modification was removed from the cfg.
So it seems that changes (some?all?) to settings made via the web gui prevent any modification of themselves via cli.
We are *going to have changes made both via cli and via the web gui.
Is there some way to know what settings can or can't be changed?
Or maybe a way to force cfg changes to override saved db changes?
Can't make *some changes to cfg files in XI
Re: Can't make *some changes to cfg files in XI
What I've found is you can modify or add to a .cfg by importing, but not delete, which makes sense. You'd need to delete the object, then import to remove info.
Below are a few examples of deleting from the shell. Chances are there are other php scripts for deleting other stuff.
pushd .; cd /usr/local/nagiosxi/scripts/; ./nagiosql_delete_service.php –-config=<service file name>; popd
pushd .; cd /usr/local/nagiosxi/scripts/; ./nagiosql_delete_host.php --host=<host>; popd
Understand that deleting an object will also delete it from groups that its in so you then need to import it into the group as well.
Below are a few examples of deleting from the shell. Chances are there are other php scripts for deleting other stuff.
pushd .; cd /usr/local/nagiosxi/scripts/; ./nagiosql_delete_service.php –-config=<service file name>; popd
pushd .; cd /usr/local/nagiosxi/scripts/; ./nagiosql_delete_host.php --host=<host>; popd
Understand that deleting an object will also delete it from groups that its in so you then need to import it into the group as well.
Re: Can't make *some changes to cfg files in XI
TNX!
I just ran some more test reloads and I see the behavior you describe.
I was confusing removing the entire line with removing the entry.
I can indeed *remove a specific contact_group from a service that's been added via the gui but I *can't remove the entire contact_groups line via cli once it's been added by *either the gui or cli.
Removing all the contact groups from the service gui *did, however, remove the contact_groups line from service cfg.
I just ran some more test reloads and I see the behavior you describe.
I was confusing removing the entire line with removing the entry.
I can indeed *remove a specific contact_group from a service that's been added via the gui but I *can't remove the entire contact_groups line via cli once it's been added by *either the gui or cli.
Removing all the contact groups from the service gui *did, however, remove the contact_groups line from service cfg.
Re: Can't make *some changes to cfg files in XI
teh0015, have you looked at the new API functionality in XI 5+? If not, you can read more under the Help menu item and look at the Nagios XI API Docs section.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Can't make *some changes to cfg files in XI
Yes I have also identified this behaviour previously. Once an object has a directive defined, it does not seem to be possible to stop the directive from being used. This occurs when using the import .cfg files method or using the new API in XI 5+.teh0015 wrote:but I *can't remove the entire contact_groups line via cli once it's been added by *either the gui or cli.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.