Page 1 of 1

Delete host using REST API error on XI version 5.5.11

Posted: Tue Jun 18, 2019 7:08 am
by JosephH
I am using Nagios XI 5.5.11 Rest API to delete a host and get this error: {"error":"Host cannot be deleted using this method. Must be deleted through the CCM."}. I also make sure to delete all the services of this host before delete itself. Based on one of the search result https://support.nagios.com/forum/viewto ... 16&t=42680, I added the sleep for 10 second, looks like it works for sometime, but not all the time. Any help is greatly appreciated.

Re: Delete host using REST API error on XI version 5.5.11

Posted: Tue Jun 18, 2019 11:56 am
by benjaminsmith
Hi Joseph,

This host might have existing dependent relationships. Can you verify this by going to the Configure > CCM > Monitoring > Hosts and search for the host from the box in the upper right. In the listing, under the actions heading, click on the icon for relationships.

If that is not the issue, can you post the API command for us to review. Thanks

Re: Delete host using REST API error on XI version 5.5.11

Posted: Tue Jun 18, 2019 1:32 pm
by JosephH
hi benjaminsmith,

Thank you for the quick response. I followed your direction for this host, and the only thing for this host listed on the object relationships is contacts - somename. Nothing else.

the command I used like this:
https://nagiosxiserver/nagiosxi/api/v1/ ... st&force=1
after that, I ran applyconfig=1.
https://nagiosxiserver/nagiosxi/api/v1/ ... y=myapikey

Let me know if more info needed.

Thank you,
Joseph

Re: Delete host using REST API error on XI version 5.5.11

Posted: Wed Jun 19, 2019 12:54 pm
by benjaminsmith
Hi Joseph,

I rolled back my text VM to this version and was able to repeat the error you getting. However, on the lastet version it is working with the following command.
curl -XDELETE "http://<ip address>/nagiosxi/api/v1/config/host/testapihost?apikey=<api key>&pretty=1&host_name=testhost&applyconfig=1"
Are you able to upgrade to the latest version?

Re: Delete host using REST API error on XI version 5.5.11

Posted: Wed Jul 24, 2019 12:41 pm
by JosephH
upgrade to 5.6.5 and worked.

Re: Delete host using REST API error on XI version 5.5.11

Posted: Wed Jul 24, 2019 1:26 pm
by mbellerue
Glad to hear it's working now!