I am trying to figure out the correct way to use a PowerShell script to run on a Windows server so it schedules downtime using the Nagios API. I am looking to add this to a pre-patch process so it runs, the host schedules downtime for 1 or 2 hours (still undecided) then returns to normal monitoring mode after the schedule expires.
Anyone doing something similar that they could provide me some examples? I am still wet behind the ears with PowerShell but trying to do more and more with it.
PowerShell script schedule downtime
Re: PowerShell script schedule downtime
This is in the Nagios Core section, as Nagios Core doesn't have an API did you mean for this to be in the XI section?
Re: PowerShell script schedule downtime
Yes, I was jumping around the various boards looking for a solution.
Are you able to move this thread?
Are you able to move this thread?
Re: PowerShell script schedule downtime
Yes, I just moved it to the Customer XI section.
So for a powershell script you're just going to be doing a web post using the downtime API URL:
I did find this google'ing, that should give you a really good generic example:
What specific questions do you have about it?
So for a powershell script you're just going to be doing a web post using the downtime API URL:
Code: Select all
http://YOURXISERVER/nagiosxi/help/api-system-reference.php#system-schedule-downtimeCode: Select all
https://www.powershellgallery.com/packages/MrANagios/1.2/Content/Invoke-NagiosXiApi.ps1