This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Acknowledge Events Log Table via API

I would like to acknowledge events in the events log table via the invoke command.   Is this possible?  If not?

How do a get a list of Alerts for a specific node,  I then would like to use that information to pass into a ticketing system.

I already have the form interface, I just need to either know how the Acknowledge the Events in the Events log using the swis or SWQL or get the list of Alerts associated with a node and then Acknowledge them.

Thank you for your help.

Charles

Parents
  • You acknowledge events through the invoke API by calling the "Acknowledge" verb on the "Orion.Events" entity.

    This is a powershell script that acknowledges events.

    if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue))

    {

      Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue

    }

    swisTarget = 'localhost'

    $username="admin"

    $password=""

    $swis = Connect-Swis -host $swisTarget -UserName $username -Password $password

    $eventIds = 2455, 2456

    [xml]$invokeResult

    $invokeResult = Invoke-SwisVerb $swis "Orion.Events" "Acknowledge" @(, [int[]]@($eventIds))

    $result = $invokeResult.ChildNodes.Value

    Write-Host "Acknowledge events returned $result"

    Here is a powershell script that gets the active "advanced" alerts for a node

    if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue))

    {

      Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue

    }

    $swisTarget = 'localhost'

    $username="admin"

    $password=""

    $swis = Connect-Swis -host $swisTarget -UserName $username -Password $password

    # the node that we are interested in

    $nodeId = 12

    Write-Host "Getting alerts for Node with Id $nodeId"

    #This query retrieves the list of alerts for a specific node.  Note the ObjectType.

    $query = "SELECT AlertDefID, ActiveObject, ObjectName, AlertMessage, TriggerTimeStamp

    FROM Orion.AlertStatus Where ActiveObject = @nodeId AND ObjectType = 'Node'"

    $queryParams = @{

      nodeId=$nodeId;

    }

    $queryResult = Get-SwisData $swis $query $queryParams

    $queryResult | ForEach-Object {Write-Host ("Node {0} with id={1} alertDefId={2} TriggeredOn:{3} " -f $_.ObjectName,  $_.ActiveObject, $_.AlertDefID, $_.TriggerTimeStamp.ToLocalTime()) -foregroundcolor green}

  • Thank you, I will try this out.  Though I am using Perl I will need to convert the PowerShell to perl.

Reply Children
No Data