cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 12

Acknowledge Alert via SDK Perl

Jump to solution

I am calling the Acknowledge Alert syntax using the example from the sample.pl file for the Perl example.

When I do the following

      my $alertDefId = $alert->{alertdefid};

       my $alertNodeId = $alert->{activeobject};

       my $node_alerts = \SOAP::Data->name('ArrayOfAlertInfo')->value(

                      SOAP::Data->name('AlertInfo')->attr({xmlns=>'http://schemas.solarwinds.com/2008/Orion'})->value(

                      SOAP::Data->name('DefinitionId')->type('')->value($alertDefId),

                      SOAP::Data->name('ObjectType')->type('')->value('Node'),

                      SOAP::Data->name('ObjectId')->type('')->value($alertNodeId)

                     )

                   );

       my $result = $swql->swis->Invoke( 'Orion.AlertStatus', 'Acknowledge', [$node_alerts] );

I get a return value of 'false' and the Alert is NOT Acknowledged. 

How can I acknowledge the Alert through the SDK, remember I am doing this with PERL and I am using the InformationService.pm and Orion.pm modules?

Thank you,

Charles

Tags (2)
0 Kudos
1 Solution

We are spending too much time fighting with SOAP and XML serialization. JSON is much more forgiving. I was able to acknowlege an alert by posting this body to https://localhost:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertStatus/Acknowledge:

[

  [

    {

      "DefinitionId": "F70CAB60-D451-4DBB-97D1-C84649DFC81E",

      "ObjectId": "19",

      "ObjectType": "Interface"

    }

  ]

]

Explaining the brackets and braces: the post data for .../Invoke/... is a json array of arguments. Orion.AlertStatus.Acknowledge takes one argument that is a list of AlertInfo objects, so that's the inner array. The json object inside the two levels of json array is the actual AlertInfo object. No need for a class name or namespace - it will figure it out.

View solution in original post

8 Replies
Level 13

Can you try placing the namespace on the ArrayOfAlertInfo element instead of AlertInfo and see if that works?

0 Kudos

I believe it is on the ArrayOfAlertInfo

my $node_alerts = \SOAP::Data->name('ArrayOfAlertInfo')->value(

                      SOAP::Data->name('AlertInfo')->attr({xmlns=>'http://schemas.solarwinds.com/2008/Orion'})->value(

                      SOAP::Data->name('DefinitionId')->type('')->value($alertDefId),

                      SOAP::Data->name('ObjectType')->type('')->value('Node'),

                      SOAP::Data->name('ObjectId')->type('')->value($alertNodeId)

                     )

                   );

0 Kudos

In your snippet, the xmlns is being added to the "AlertInfo" element.

my $node_alerts = \SOAP::Data->name('ArrayOfAlertInfo')->value(

                      SOAP::Data->name('AlertInfo')->attr({xmlns=>'http://schemas.solarwinds.com/2008/Orion'})->value(

                      SOAP::Data->name('DefinitionId')->type('')->value($alertDefId),

                      SOAP::Data->name('ObjectType')->type('')->value('Node'),

                      SOAP::Data->name('ObjectId')->type('')->value($alertNodeId)

                     )

                   );

0 Kudos

I get the same response:

       my $node_alerts = \SOAP::Data->name('ArrayOfAlertInfo')->attr({xmlns=>'http://schemas.solarwinds.com/2008/Orion'})->value(

                      SOAP::Data->name('AlertInfo')->value(

                      SOAP::Data->name('DefinitionId')->type('')->value($alertDefId),

                      SOAP::Data->name('ObjectType')->type('')->value('Node'),

                      SOAP::Data->name('ObjectId')->type('')->value($alertNodeId)

                     )

                   );

false

0 Kudos

I can't speak to this particular issue, but since I recently went through the fight of getting Perl to talk to Orion, you may be able to derive some REST/JSON techniques from here: TC18: Customize Polling Intervals With the Orion SDK

Leon Adato | Head Geek
------
"Measure what is measurable,
and make measurable what is not so." - Gallileo

0 Kudos

We are spending too much time fighting with SOAP and XML serialization. JSON is much more forgiving. I was able to acknowlege an alert by posting this body to https://localhost:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertStatus/Acknowledge:

[

  [

    {

      "DefinitionId": "F70CAB60-D451-4DBB-97D1-C84649DFC81E",

      "ObjectId": "19",

      "ObjectType": "Interface"

    }

  ]

]

Explaining the brackets and braces: the post data for .../Invoke/... is a json array of arguments. Orion.AlertStatus.Acknowledge takes one argument that is a list of AlertInfo objects, so that's the inner array. The json object inside the two levels of json array is the actual AlertInfo object. No need for a class name or namespace - it will figure it out.

View solution in original post

Hi tdanner

After reading different threads I guess below are the two methods to acknowledge

First method is as below :

https://localhost:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertStatus/Acknowledge

which accepts json in below format as explained in above thread

  1.   [ 
  2.     { 
  3.       "DefinitionId": "F70CAB60-D451-4DBB-97D1-C84649DFC81E"
  4.       "ObjectId": "19"
  5.       "ObjectType": "Interface" 
  6.     } 
  7.   ] 

Second method is

"http://$swhostname:$swport/SolarWinds/InformationService/v3/Json/swis://$swhostname/Orion/Orion.Node...";

where it is using swis URI method to invoke acknowledge using node ID.

so my query is there any way we can get AlertId from nodeID because we are passing AlertDefId and we would like to use swis URI based method.

Regards,

Abhijit Khewale

0 Kudos

This thread is from 2014. Since then, we have deprecated this API (it still works, but is not recommended for new scripts) and introduced a new one that is documented here: Alerts · solarwinds/OrionSDK Wiki · GitHub . I recommend you review that page and use the Orion.AlertActive/Acknowledge verb to ack alerts.

0 Kudos