PowerShell script schedule downtime

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

PowerShell script schedule downtime

Post by jkinning »

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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: PowerShell script schedule downtime

Post by ssax »

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?
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: PowerShell script schedule downtime

Post by jkinning »

Yes, I was jumping around the various boards looking for a solution.

Are you able to move this thread?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: PowerShell script schedule downtime

Post by ssax »

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:

Code: Select all

http://YOURXISERVER/nagiosxi/help/api-system-reference.php#system-schedule-downtime
I did find this google'ing, that should give you a really good generic example:

Code: Select all

https://www.powershellgallery.com/packages/MrANagios/1.2/Content/Invoke-NagiosXiApi.ps1
What specific questions do you have about it?
Locked