Using REST API, how to clear host's hostgroup field
Posted: Sun Mar 25, 2018 1:35 pm
I'm using the REST API operation POST config/host. In this POST, I want to empty out the hostgroup column for a given host. The problem I'm having is that when I send an empty string or null, the hostgroup value still remains on the host. How can I clear this value using the POST config/host operation?
I know I could create a "dummy" host group and assign it to that but I don't want to do that because it creates an extraneous hostgroup that I don't want. And, I would have to make this dummy hostgroup "active." Not ideal nor wanted if I can help it.
I know how to create custom endpoints so maybe someone could offer advice on how I could leverage that process so I can call my own endpoint and then use whatever methods are available within Nagios to remove all hostsgroups from a host. Any feedback is much appreciated. Thank you!
Todd
p.s., I wish there was good documentation on how to interact with Nagios once I have a custom endpoint. I have basic custom endpoints created but they only serve purposes of things like SELECT data from MySQL and return that. I'd like more advanced stuff like changing data in Nagios with my custom endpoint. Is there any documentation for that anywhere?
I know I could create a "dummy" host group and assign it to that but I don't want to do that because it creates an extraneous hostgroup that I don't want. And, I would have to make this dummy hostgroup "active." Not ideal nor wanted if I can help it.
I know how to create custom endpoints so maybe someone could offer advice on how I could leverage that process so I can call my own endpoint and then use whatever methods are available within Nagios to remove all hostsgroups from a host. Any feedback is much appreciated. Thank you!
Todd
p.s., I wish there was good documentation on how to interact with Nagios once I have a custom endpoint. I have basic custom endpoints created but they only serve purposes of things like SELECT data from MySQL and return that. I'd like more advanced stuff like changing data in Nagios with my custom endpoint. Is there any documentation for that anywhere?