I have an issue that I need some help with. I’ve made some progress, but I’m getting stuck with the curl call to update the target host. First, some background. We have some Windows IOT appliances that are being deployed at many different sites. For one reason or another, it’s not possible for static IPs to always be assigned to these hosts. I have written some powershell that will grab the current IP address and spit it out to a text file when it’s run. If the txt file already exists, it will grab the current IP address, spit it out to a txt file, and compare the hashes of the two files. If they match, there’s nothing to do. If they don’t match, it should use the icinga API to update the address of the host with the current IP address.
For the life of me, I can’t get the curl command to update the host. This is the command I’m using:
Thanks for posting. Even after taking a second look at your modifying curl command, it looks quite right - also compared to the example from the docs. Some ideas to check:
In your second querying query, the Icinga 2 master URL differs. Is this just a copy/paste or redaction failure or do you might have two different Icinga 2 setups?
What are the permissions of your ApiUser “u”? To modify host objects, objects/modify/Host is required.
What is written to the icinga2.log when sending the modifying API request?
I think you may have discovered the error. I use that api user to generate tickets when working with Linux hosts. I didn’t even think to look at the user’s permissions again to see if they were allowed to modify hosts. I did discover another small, related issue. I think I meant to use the director API rather than the normal icinga API, so now I’m running into similar issues again.