- Service runs on hostgroup
- Host gets added to hostgroup via template (or directly via .cfg file dropped into import directory)
- Sometimes, individual hosts get added to the hosts list for a specific service
- Never does a service get added to a single host if that service is the same as an existing service (other than the hostname, of course)
We've confirmed that if we have a host named HOSTA and a host named HOSTB and a service named SERVICEX that is configured to run on both HOSTA and HOSTB, using the API DELETE config/service command will delete the entire service, even if host_name=HOSTA on the API URL. This is bad thing #1.
We've also confirmed that there is no way (that we can figure out) through the API to mark SERVICEX as "not active." Nor can we mark only the HOSTB version of SERVICEX as inactive. Which is understandable, since it's a single service listed as running on multiple hosts.
It would be ideal if we could mark the service or host definition as active/inactive, just like one can on the GUI. This would solve @WillH's problems as well as ours, and let us do an end-run around some of other things that we currently have to do because of the hot mess that is Nagios Core configuration files.
Ideally, the entire thing would be rewritten so you could define an object that has your default monitoring stuff, then inherit that object on another object that defines a host, then have another object that inherits that object that defines a service, and so on. Object Oriented Configuration for monitoring, basically. Then one could easily insert something into the chain or override an instance of it, just like in any OOP language. But I digress.
In the short term, is there any way to use the API to disable something yet? If not, is there any way to delete a host from the list of hosts that the service runs on without deleting the entire service?