Delete host using REST API error on XI version 5.5.11

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
JosephH
Posts: 34
Joined: Fri Oct 12, 2018 10:04 am

Delete host using REST API error on XI version 5.5.11

Post 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.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
JosephH
Posts: 34
Joined: Fri Oct 12, 2018 10:04 am

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

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
JosephH
Posts: 34
Joined: Fri Oct 12, 2018 10:04 am

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

Post by JosephH »

upgrade to 5.6.5 and worked.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

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

Post by mbellerue »

Glad to hear it's working now!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked