cancel
Showing results for 
Search instead for 
Did you mean: 
jfoley
Level 8

Re: Orion SDK Information

Hmm. That seemed to work:

$ curl -v -k -u admin: -X POST -H "Content-Type: application/json" -d @postdata.                                  json https://10.10.10.6:17778/SolarWinds/InformationService/v3/Json/Query

* STATE: INIT => CONNECT handle 0x60002d3f0; line 1011 (connection #-5000)

* Hostname was NOT found in DNS cache

*   Trying 10.10.10.6...

* Adding handle: conn: 0x6000697d0

* Adding handle: send: 0

* Adding handle: recv: 0

* Curl_addHandleToPipeline: length: 1

* 0x60002d3f0 is at send pipe head!

* - Conn 0 (0x6000697d0) send_pipe: 1, recv_pipe: 0

* STATE: CONNECT => WAITCONNECT handle 0x60002d3f0; line 1058 (connection #0)

* Connected to 10.10.10.6 (10.10.10.6) port 17778 (#0)

* successfully set certificate verify locations:

*   CAfile: /usr/ssl/certs/ca-bundle.crt

  CApath: none

* SSLv3, TLS handshake, Client hello (1):

* STATE: WAITCONNECT => PROTOCONNECT handle 0x60002d3f0; line 1171 (connection #                                  0)

* SSLv3, TLS handshake, Server hello (2):

* SSLv3, TLS handshake, CERT (11):

* SSLv3, TLS handshake, Server finished (14):

* SSLv3, TLS handshake, Client key exchange (16):

* SSLv3, TLS change cipher, Client hello (1):

* SSLv3, TLS handshake, Finished (20):

* SSLv3, TLS change cipher, Client hello (1):

* SSLv3, TLS handshake, Finished (20):

* SSL connection using AES128-SHA256

* Server certificate:

*        subject: CN=SolarWinds-Orion

*        start date: 2013-10-08 19:59:53 GMT

*        expire date: 2039-12-31 23:59:59 GMT

*        issuer: CN=SolarWinds-Orion

*        SSL certificate verify result: self signed certificate (18), continuing                                   anyway.

* STATE: PROTOCONNECT => DO handle 0x60002d3f0; line 1190 (connection #0)

* Server auth using Basic with user 'admin'

> POST /SolarWinds/InformationService/v3/Json/Query HTTP/1.1

> Authorization: Basic YWRtaW46

> User-Agent: curl/7.34.0

> Host: 10.10.10.6:17778

> Accept: */*

> Content-Type: application/json

> Content-Length: 68

>

* upload completely sent off: 68 out of 68 bytes

* STATE: DO => DO_DONE handle 0x60002d3f0; line 1263 (connection #0)

* STATE: DO_DONE => WAITPERFORM handle 0x60002d3f0; line 1384 (connection #0)

* STATE: WAITPERFORM => PERFORM handle 0x60002d3f0; line 1395 (connection #0)

* HTTP 1.1 or later with persistent connection, pipelining supported

< HTTP/1.1 200 OK

< Content-Length: 118

< Content-Type: application/json

* Server Microsoft-HTTPAPI/2.0 is not blacklisted

< Server: Microsoft-HTTPAPI/2.0

< Date: Mon, 10 Feb 2014 20:41:45 GMT

<

* STATE: PERFORM => DONE handle 0x60002d3f0; line 1565 (connection #0)

* Connection #0 to host 10.10.10.6 left intact

{"results":[{"DisplayName":"DC1SWC01 - Core Switch","DetailsUrl":"/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:1"}]}

Thanks for that example. I'll see if I can translate it to PHP.

fabi
Level 8

Re: Orion SDK Information

Why 17778 Port, with wireshark, when i connect thanks to "SWQL Studio" it's 17777 Port.

0 Kudos
derhally
Level 13

Re: Orion SDK Information

Port 17777 is the port that SWIS listens on special for special bindings, while port 17778 is the port that SWIS listens on for HTTPS connections.

0 Kudos
Highlighted
fabi
Level 8

Re: Orion SDK Information

Sorry how can i do https post javascript,

0 Kudos
derhally
Level 13

Re: Re: Orion SDK Information

fabi,

Explaining how to do it would be too much for this post.

If you have a fields with Id "username" "password" and "querytext"

You can use something like jquery to make an ajax call like this

        $(function() {

            $("#send").click(function() {

                $("#error,#results").hide();

                var address = 'https://localhost:17778/SolarWinds/InformationService/v3/Json/Query?';

                address += "query=" + encodeURIComponent($("#querytext").val());

                $.ajax({

                    url: address,

                    username: $("#username").val(),

                    password: $("#password").val(),

                    type: "GET",

                    dataType: "json",

                    success: function (data) {

                        /* handle result */

                    },

                });

            });

        });

This will only work if the caller and the Orion server are on the same domain.

0 Kudos
fabi
Level 8

Re: Re: Orion SDK Information

thanks to your support ! not work for me, but i'm not a expert in programmation.

0 Kudos
derhally
Level 13

Re: Re: Orion SDK Information

Hi fabi,

The snippet was just a starting point.  Unfortunately this kind of integration requires some knowledge of web development.  I would recommend that you have someone with that experience help you out.

0 Kudos
dyogoaj
Level 9

Re: Re: Orion SDK Information

Hello Fabi, I am based on Brazil, and we provided professional service that can help you. Drop me a menssage if you are interested.

0 Kudos
fabi
Level 8

Re: Re: Orion SDK Information

Thanks again, i try any tricks, maybe a "http get" on PHP, with solarwinds web authentification. Maybe i will can get my module ressources.

If i find a interesting solution , i post it.

0 Kudos
jfoley
Level 8

Re: Orion SDK Information

tdanner - I got it working in PHP If anybody asks for a PHP example, feel free to give them this code snippet:

  ini_set('display_errors', 'On');

  error_reporting(E_ALL);

  $endpoint = "https://localhost:17778/SolarWinds/InformationService/v3/Json/Query";

  $post_data = array(

  'query' => "SELECT TOP 1 DisplayName, DetailsUrl FROM Orion.Nodes"

  );

  $strdata = json_encode($post_data);

  $ch = curl_init($endpoint);

  curl_setopt($ch, CURLOPT_POST, 1);

  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

  curl_setopt($ch, CURLOPT_TIMEOUT, 30);

  curl_setopt($ch, CURLOPT_POSTFIELDS, $strdata);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  curl_setopt($ch, CURLOPT_USERPWD, "admin:");

  //curl_setopt($ch, CURLOPT_HEADER, 1); // This will output response headers

  curl_setopt($ch, CURLOPT_HTTPHEADER, array(

    'Content-Type: application/json',

    'Content-Length: ' . strlen($strdata)

  ));

  $result = curl_exec($ch);

  exit("Result: {$result}");

0 Kudos