So I need assistance. I am attempting to use the API to set a Scheduled Downtime for a host. The Powershell script I am using is attached, remove .txt. Can you please inspect it and give it a try. You'll need to set the Admin $apikey and $nagInstance variables. Once set you can execute the script by passing two mandatory parameters -l & -h for length in seconds & host
I am running Nagios XI 5.6.1 on my test system and when I invoke the Powershell script it appears to run successfully but I never see it actual defined within Scheduled Downtime screen or on the host itself.
I am uncertain how to troubleshoot and could use a hint in where the request which appears to be reaching and succeeding might be logged for troubleshooting.
Help is greatly appreciated...
Thanks,
Danny
p.s. I have successfully set Scheduled Downtime using Linux curl commands but this is my first attempt using Powershell.
The output from the invocation is as follows:
Code: Select all
PS C:\Users\billyBob\desktop> .\nagiosScheduledDowntime.ps1 -l 300 -h mlt-dcom-tool
StatusCode : 200
StatusDescription : OK
Content : {"success":"Schedule downtime command(s) sent successfully.","scheduled":{"hosts":["mlt-dcom-tool"]}}
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Orgin: *
Access-Control-Allow-Methods: *
Content-Length: 102
Content-Type: application/json
Date: Wed, 04 Nov 2020 19:15:17 GMT
Server: Apache/2.4.6 (Red Hat...
Forms : {}
Headers : {[Access-Control-Allow-Orgin, *], [Access-Control-Allow-Methods, *], [Content-Length, 102], [Content-Type, application/json]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 102