Sometimes we have an issue with the Addition of a host.
If a Host is being added, and that host calls for a 'Parent', but the Parent does not yet exist, something bad happens. What happens it that the API creates the 'Parent' as a blank Host, in a Deactivated state. The actual host being defined is created, and points to the deactivated Parent. The API does this.
From that point forward, Nagios commit will fail.
If the system is in that state during the off hours, and the normal Nagios XI cron jobs run, maybe at 2 or 3:00 AM, the cron will restart Nagios, and Nagios will fail to restart. Then the Nagios "Monitoring Engine" will be red until someone notices and fixes the problem. Basically, manually run the "Write Configs" and "Verify Files", read the output, and fix or delete the host with no parent.
The solution to this could be to simply have the API user check for the Parent before adding the Child host.
But - what if both the Parent and Child host are created in the same batch. In the API, if I create a Host but have not yet run a commit, I cannot see if that host has been added yet.
Can I ? If so, how.
The API will let me know if a host exists after a commit. When adding hosts in a batch, we wait until we have added them all and then commit the change.
How can we see, using the API, that a host is created and the commit for that host is pending?
The API user has asked me the following questions and made the following comments:
Could someone please assist me with a solution here?I agree that the API must be improved. Here are my suggestions to Nagios.
1) The API should not be a second class citizen to the web interfaces. Currently there are time where the API cannot delete an object but the web interface can. This should not be.
2) The API should be able to set a 'cascade' flag that can delete a host object and then all object directly tied to that host are also deleted (or re-parented)
3) The API should have a COMMIT/ROLLBACK functionality where I can make a set of changes and commit all of them at once, and if one fails, then all the changes get rolled back.
4) The API should be able to create all objects, templates, services, etc.
Thanks
Steve B