Deleting Alert via PowerShell ?

Hi everyone,

Recently i've created some automation process with SAM where every time there is a new alert created on a 3rd party monitoring system (DynaTrace), a Powershell script which SAM is running will automatically create an Orion alert by modifying some base XML file and importing the new modified XML file as an alert to Orion.

So far everything works perfect, for each Dynatrace alert, SAM is creating an Orion alert and once the Dynatrace alert cleared, The orion also clear the alert from his side.

However, since each Dynatrace Alert has a Unique ID it means SAM will create hundreds of alerts eventually.

I wanted to add a script as a RESET action which will delete the Orion alert but i couldn't find any reference anywhere to how to do it via PowerShell / python / REST.

anyone got any idea how to do it or maybe got another approach on how to automatically delete an alert once the alert got cleared ?

BR,

Chen Slight smile

Parents
  • Orion.AlertConfigurations does support DELETE operations.

    Which means should be able to run:

    # Connect to SWIS
    $SwisConnection = Connect-Swis -Hostname "myorionserver.domain.local" -Username "MyUsername" -Password "MyComplexPassword"
    
    # List all of the URI's for the Alerts
    $AlertToDelete = Get-SwisData -SwisConnection $SwisConnection -Query "SELECT Uri FROM Orion.AlertConfigurations WHERE Name = 'Name of Alert I want to Delete'"
    
    Remove-SwisObject -SwisConnection $SwisConnection -Uri $AlertToDelete

  • Thanks, work like a charm :) .

Reply Children
No Data