When i make this call through powershell, i get a HTTP 200 response from Nagios stating that it's removing the hostgroup, but the hostgroup is still there. I've toggled the applyconfig to see if that would change this, like forcing me to do a apply config but that did not change the result. Please help!
To note i have a delete method call for hosts coming from the same computer that is working successfully. Also in the Audit Log i do not see this call ever logged, but i do see the other one get logged.
The $AutoScalingGroup variable is inputted by the user who runs the script using the Read-Host command, which has the hostgroups name as a System.String (same type that is of the values in the other script i mentioned that works successfully)
Code: Select all
Invoke-WebRequest -Method Delete -Uri "https://nagios.prod02.aws.local/nagiosxi/api/v1/config/hostgroup?apikey=XXXX&pretty=1&hostgroup_name=$AutoScalingGroup&alias=HostGroup&applyconfig=1"Code: Select all
Removing BRIDGE_2019.14.6720.3671 From Nagios
StatusCode : 200
StatusDescription : OK
Content : null
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Orgin: *
Access-Control-Allow-Methods: *
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Length: 5
Content-Type: application/json
Date: Sat, 0...
Forms : {}
Headers : {[Access-Control-Allow-Orgin, *], [Access-Control-Allow-Methods, *], [Keep-Alive, timeout=5, max=100], [Connection, Keep-Alive]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : System.__ComObject
RawContentLength : 5Code: Select all
Removing BRIDGE_2019.14.6720.3671 From Nagios
null