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.

Pull data for multiple nodes

Ok - is there a way I can either pull data for multiple nodes (in a get or post)? -

I currently pull data (a few fields) looping through nodeID's but it takes 2-3 seconds to return and parse my data for each node.  Am working with about 1700 nodes for this data pull, so it takes more than 1 hour.  I would like to get this down to about 10 minutes.  So instead of polling for each node, I wanted to pass in an array of nodes and get the data back in one big pull, then parse it.  I am working with Perl.

Also - as a less desirable alternative, I have a report created where I could see the same fields I need, is there any way to pull the data from the report using api?  I seem to only get back all the format and query data - not the actual data.

thanks for any info.

sz

  • What data are you trying to get? I would assume that a normal query would work for you. Like:

    SELECT ...a few fields...

    FROM Orion.Nodes

    WHERE NodeID IN (...1700 NodeID values...)

  • Just Orion.Node.Status, ResponseTime and PacketLoss %

    Currently am looping through one node at a time – then using rest/json to post – see code below

    I thought there was a way either in json or swiss to put an array as a $param

    Or is it as simiple as an array ref as $nodeID? (I actually didn't try this yet), just thought of it.

    thanks

    my $hostname = x.x.x.x;

    my $username = xxxxx;

    my $password = xxxxx;

    my $endpoint = "https://$hostname:17778/SolarWinds/InformationService/v3/Json";

    $rest->getUseragent()->proxy(['https'], $endpoint);

    my $headers = {

          Authorization => 'Basic ' . encode_base64($username . ':' . $password),

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

       };

    my $uri = "https://$hostname:17778/SolarWinds/InformationService/v3/Json/Query";

    my $json = JSON->new->allow_nonref->utf8;

    Foreach my $n(@nodeID) {

    my ($query,$params) = ("SELECT Caption,Status,ResponseTime,PercentLoss FROM Orion.Nodes WHERE NodeID = ".'@id', {'id'=>$nodeID})

    my $payload =  { query => $query, parameters => $params }; #formats the payload

    my $json_text = $json->encode($payload); #encodes

    my $response = $rest->POST($uri, $json_text, $headers);

    my $data = $json->decode($rest->responseContent());

    }

  • You can't pass the @nodeID array directly, but you can expand it into the query. Like this:

    SELECT Caption, Status, ResponseTime, PercentLoss FROM Orion.Nodes WHERE NodeID IN (1, 2, 3, 4)

  • So I wanted to keep this using JSON/REST because I am kicking this off from a linux box and my libs are restricted..

    BUT you gave me a better idea - since my nodes are divided between two separate snmp Location strings. I change my query from NodeID to Location and ran once for each group.  It comes back SO fast I just have to parse out all the not needed devices then I have my data.  Takes about 10 seconds to run both pulls!

    So thanks for the info that made me think this out a little better!!