8 Replies Latest reply on Sep 28, 2016 1:32 PM by kmillerusaf

    Scheduled task using Powershell or similar to disable/enable alerts during maintenance windows


      Hello all,


      We have scheduled maintenance windows typically once a month that start at 4 AM and end at 7 AM. We integrate SolarWinds NPM with PagerDuty to send alerts so during the maintenance window, we manually disable the SolarWinds alerts that would typically generate alerts in PagerDuty for obvious reasons.


      At least twice now, we have forgotten to enable those alerts after the maintenance window has finished (this time for over 2 weeks before we noticed) so we'd like to automate this process.


      After some research and playing around, I installed the SWQL Studio tool and was able to get the URI of the 2 alerts that need to be disabled and enabled. I was even able to use the Postman REST client to change the "Enabled" value of an alert to False and then back to True.


      Now comes the part where I'm out of my depth... Well I was out of my depth initially as well. I'd like to schedule this as an scheduled task on our Orion server. I'm assuming this must be done in PowerShell but if there's another way, please feel free to correct me. Also, I have little to no PowerShell experience besides running some Cmdlets so if someone could provide some direction, I would really appreciate it.


      Essentially, what I want to do is this:


      Set the Enabled field of swis://orionserver/Orion/Orion.AlertConfigurations/AlertID=99 and swis://orionserver/Orion/Orion.AlertConfigurations/AlertID=100 to False during the maintenance window and back to True when the maintenance window ends.