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.

"Graphs stating Data is not available - several hours after interface is auto added"

We have written a perl script because the API within solar winds is not working correctly.  Solar winds support is saying they can't help with the script.

Anyone with any information is greatly appreciated.

When creating interface ID 1350120 the proper default pollers were added, but when creating interface ID 1350124 only two of the default pollers were added. Screen shot attached. When posting to cpmeast:17778/.../AddInterfacesOnNode


Rebecca,

It is likely that the script you are using was written for a previous version of Orion. I would recommend you check the following thwack post for information on a working script post spring 2015.

https://thwack.solarwinds.com/message/271956

I must mention that using these scripts is unsupported. While they may work for you we will be unable to provide support to make them work if you have problems. If you do run into issues I would suggest posting on the thwack forums for help.

Please let me know if you have further questions.


Rebecca,

Any scripts written for the API are using the Orion SDK. The Orion SDK is a free tool. For free tools we do not offer product support.

You can ask for help on thwack and someone from SolarWinds may respond to your post, or more likely other customers who have done what you are doing will be able to help. However normal support channels are unable to provide support for it.

I have confirmed this with both application engineers and my manager.

Please let me know if you have further questions.


No, This code was actually written against the current api, hence it is supported. We require an escalation at this point. Michael Shipper | Systems Engineer | Desk: 314.288.3096| Cell: 314.348.1895 12405 Powerscourt Drive, Saint Louis, MO 63131



Rebecca,

I understand where you are coming from but this is likely not a bug. Regardless though any problems with the API/Orion SDK would need to be posted on the Orion SDK section of thwack for help.

https://thwack.solarwinds.com/community/labs_tht/orion-sdk

If you post about your issue there someone should chime in and help you.

  • I can help with this, but I need some more information. Please post:

    1. The version of NPM you are using.

    2. Your perl script (with credentials or any other sensitive information removed, of course)

    3. The screenshot referenced in the message above.

  • Version of NPM 11.5.2

    The screen shot below (dtr03jnvlwi) gives the differences

    Script files are attached.

    attachments.zip
  • Just a note, I work with Rebecca and developed the libraries we are using.

    This is technically a known bug with: Invoke/Orion.NPM.Interfaces/AddInterfacesOnNode

    The work around we are using is as follows:

    1. Get the current list of interface pollers by interface type for the device

    2. Once an interface is added get the current list of pollers

    3. Add any default pollers that were not added.

    Again this is a bug that showed up as of version: Version of NPM 11.5.2

    Here are the excerpts to reproduce the bug:

    =head1 Class Constants

    The following constants are accessible via: Charter::SolarWinds::REST->CONSTANT

      DEFAULT_USER=>'admin';

      DEFAULT_PASS=>'ch@rt3r';

      DEFAULT_SERVER=>'cpmeast';

      DEFAULT_PORT=>17778;

      DEFAULT_PROTO=>'https';

    BASE_URI=>'%s://%s:%i/SolarWinds/InformationService/v3/Json/%s';

    =cut

    use constant DEFAULT_USER=>'setme';

    use constant DEFAULT_PASS=>'setme';

    use constant DEFAULT_SERVER=>'setme';

    use constant DEFAULT_PORT=>17778;

    use constant DEFAULT_PROTO=>'https';

    use constant BASE_URI=>'%s://%s:%i/SolarWinds/InformationService/v3/Json/%s';

    =head2 OO Methods

    This section covers the OO Methods of the class.

    =over 4

    =item * Object Constructor.

    The object constructor takes key=>value pairs all aguments are optional, default values are pulled from the constants DEFAULT_*.

      USER PASS SERVER PORT PROTO

    =cut

    sub new {

      my ($class,%args)=@_;

      foreach my $key (qw(USER PASS SERVER PORT PROTO)) {

        my $method="DEFAULT_$key";

        next if exists $args{$key};

        $args{$key}=$class->$method;

      }

      my $self=$class->SUPER::new(%args);

      $self->{header}=[

        Authorization=>'Basic '.MIME::Base64::encode_base64($self->{USER} . ':' . $self->{PASS}),

        'Content-Type' => 'application/json',

      ];

      return $self;

    }

    =item * my $result=$self->NodeInterfaceAddDefaultPollers($nodeId,$interfaec_ref);

    Returns a Charter::Result Object: When true it contains the results, when false it contains the error.

    $interface_ref represents object listed from the DiscoverInterfacesOnNode that need to be added to the default pollers.

    =cut

    sub NodeInterfaceAddDefaultPollers {

      my ($self,$nodeId,$data)=@_;

      $self->log_info("starting");

      # force a string;

      $nodeId .='';

      my $request=$self->build_request('POST','Invoke/Orion.NPM.Interfaces/AddInterfacesOnNode',[$nodeId,$data,'AddDefaultPollers']);

      my $result=$self->run_request($request);

      $self->log_info("stopping");

      return $result;

    }

    =item * my $request=$self->build_request('GET|POST|PUT|DELETE',$path,undef|$ref);

    Creates an HTTP::Request object with the default options set.

    =cut

    sub build_request {

      my ($self,$method,$path,$data)=@_;

      my $uri=sprintf $self->BASE_URI,@{$self}{qw(PROTO SERVER PORT )},$path;

      my $content=undef;

      my $headers=[@{$self->{header}}];

      if(defined($data)) {

        $content=$JSON->encode($data);

        push @{$headers},'Content-Length'=>length($content);

      }

      my $request=HTTP::Request->new($method,$uri,$headers,$content);

      $self->log_debug($request->as_string);

      return $request;

    }

    =item * my $result=$self->run_request($request);

    Takes a given HTTP::Request object and runs it returing a Charter::Result object.

    What the object contains is relative to the request run..  If the result code of the request

    was not a 20x value then the object is false.

    =cut

    sub run_request {

      my ($self,$request)=@_;

      my $response=$UA->request($request);

      $self->log_debug($response->as_string);

      my $content=$response->decoded_content;

      if($response->is_success) {

        if($content=~ /^\s*[\[\{]/s) {

          my $data=eval {$JSON->decode($content)};

          if($@) {

            return new_false Charter::Result("Code: [".$response->code."] JSON Decode error [$@] Content:  $content",$response);

          } else {

            return new_true Charter::Result($data,$response);

          }

        } else {

          return new_true Charter::Result($content,$response);

        }

      } else {

        return new_false Charter::Result("Code: [".$response->code."] http error [".$response->status_line."] Content: $content",$response);

      }

    }

  • A few questions:

    1. You said this bug showed up in 11.5.2. What is the last version it worked correctly in?

    2. Does this affect interfaces on all device types, or just some?

    3. The code shown here includes the call to AddInterfacesOnNode, but not the call to DiscoverInterfacesOnNode. Can you show that code as well?

  • So here are the answers to the questions:

    I have released all of the code on cpan, people started using it almost as soon as I posted it.. which I wasn't expecting, but hay.

    Michael Shipper - search.cpan.org

    1. You said this bug showed up in 11.5.2. What is the last version it worked correctly in?

    10.2, but it didn't work correctly there either,  in fact using the AddNoPollers option added the correct default pollers even though it was documented as not adding any, so we used that option in stead.

    Using AddDefaultPollers is just as broken as it is now.

    2. Does this affect interfaces on all device types, or just some?

    The behavior is now completely random now.. we cannot predict when it will or will not work, and affects all interfaces now.

    3. The code shown here includes the call to AddInterfacesOnNode, but not the call to DiscoverInterfacesOnNode. Can you show that code as well?

    Example Work around can be found here:

    http://search.cpan.org/~akalinux/Net-SolarWinds-REST-0.08/lib/Net/SolarWinds/CookBook.pod

    =item * my $result=$self->DiscoverInterfacesOnNode($nodeId)

    Returns a Net::SolarWinds::Result Object: When true it contains the results, when false it contains the error.

    =cut

    sub DiscoverInterfacesOnNode {

      my ($self,$nodeId)=@_;

      # force a string;

      $nodeId .='';

      my $request=$self->build_request('POST','Invoke/Orion.NPM.Interfaces/DiscoverInterfacesOnNode',[$nodeId]);

      my $result=$self->run_request($request);

      return $result;

    }