5 Replies Latest reply on Apr 24, 2014 5:01 PM by tdanner

    Acknowledge Alert via SDK Perl

    c.gura

      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

        • Re: Acknowledge Alert via SDK Perl
          derhally

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

            • Re: Acknowledge Alert via SDK Perl
              c.gura

              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)

                                   )

                                 );

                • Re: Acknowledge Alert via SDK Perl
                  derhally

                  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)

                                       )

                                     );

                    • Re: Acknowledge Alert via SDK Perl
                      c.gura

                      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

                        • Re: Re: Acknowledge Alert via SDK Perl
                          tdanner

                          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.