-
50. Re: Orion SDK Information
jfoley Feb 10, 2014 2:43 PM (in response to tdanner)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.
-
51. Re: Orion SDK Information
fabi Feb 11, 2014 7:10 AM (in response to jfoley)Why 17778 Port, with wireshark, when i connect thanks to "SWQL Studio" it's 17777 Port.
-
52. Re: Orion SDK Information
derhally Feb 11, 2014 7:13 AM (in response to fabi)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.
-
53. Re: Orion SDK Information
fabi Feb 11, 2014 7:33 AM (in response to derhally)Sorry how can i do https post javascript,
-
54. Re: Re: Orion SDK Information
derhally Feb 11, 2014 2:54 PM (in response to fabi)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.
-
55. Re: Re: Orion SDK Information
fabi Feb 12, 2014 4:11 AM (in response to derhally)thanks to your support ! not work for me, but i'm not a expert in programmation.
-
56. Re: Re: Orion SDK Information
derhally Feb 12, 2014 6:50 AM (in response to fabi)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.
-
57. Re: Re: Orion SDK Information
dyogoaj Feb 12, 2014 6:58 AM (in response to fabi)Hello Fabi, I am based on Brazil, and we provided professional service that can help you. Drop me a menssage if you are interested.
-
58. Re: Re: Orion SDK Information
fabi Feb 12, 2014 7:28 AM (in response to derhally)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.
-
59. Re: Orion SDK Information
jfoley Feb 12, 2014 9:53 AM (in response to tdanner)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}");
-
60. Re: Orion SDK Information
tdanner Feb 12, 2014 10:45 AM (in response to jfoley)Thanks for sharing!
-
61. Re: Orion SDK Information
jfoley Feb 12, 2014 12:15 PM (in response to tdanner)Where can I find more documentation on the JSON REST API for querying?
-
62. Re: Orion SDK Information
tdanner Feb 12, 2014 1:02 PM (in response to jfoley)It's in the "Orion SDK.pdf" document installed with the SDK. Linked on the start menu as "Technical Reference".
-
63. Re: Orion SDK Information
jfoley Feb 12, 2014 1:18 PM (in response to tdanner)Thanks, I found it I'm new to both the Orion system & its terminology - could you point me to where in the document it talks about how to receive, let's say, bandwidth information on Interface ID 117 (the URL to view it in the browser is:
/Orion/Interfaces/InterfaceDetails.aspx?NetObject=I:117&view=InterfaceDetails
)
-
64. Re: Re: Orion SDK Information
tdanner Feb 12, 2014 2:58 PM (in response to jfoley)Sure. Interface traffic history is in the Orion.NPM.InterfaceTraffic entity. You can query it like this:
SELECT DateTime, InAveragebps, InMinbps, InMaxbps, InTotalBytes, InTotalPkts, InAvgUniCastPkts, InMinUniCastPkts, InMaxUniCastPkts, InAvgMultiCastPkts, InMinMultiCastPkts, InMaxMultiCastPkts, OutAveragebps, OutMinbps, OutMaxbps, OutTotalBytes, OutTotalPkts, OutAvgUniCastPkts, OutMaxUniCastPkts, OutMinUniCastPkts, OutAvgMultiCastPkts, OutMinMultiCastPkts, OutMaxMultiCastPkts, TotalBytes, TotalPackets, Averagebps, OutPercentUtil, InPercentUtil, PercentUtil FROM Orion.NPM.InterfaceTraffic WHERE InterfaceID=117 AND DateTime > GetUtcDate()-1
That will return all traffic samples in the last 24 hours. You can adjust the WHERE clause to select a particular time range.
-
65. Re: Re: Orion SDK Information
jfoley Feb 12, 2014 3:05 PM (in response to tdanner)Thanks! Where can I find a list of properties like this? I couldn't find anything in the Orion SDK.pdf. Is there somewhere I can find a list of each Object Model and its properties?
-
66. Re: Re: Orion SDK Information
tdanner Feb 12, 2014 3:18 PM (in response to jfoley)In the start menu under "SolarWinds Orion SDK", there's a link called "Schema Documentation (v3.0)" that has a list of the entity types and their properties. You can also run SWQL Studio, connect to Orion, and explore the object model this way.
-
67. Re: Orion SDK Information
fabi Feb 14, 2014 4:52 AM (in response to derhally)Ok i found a interesting solution, to integrate a module map or everything that you create :
- First, create a account user.
- Use a automatic authentification http url :
<iframe name="inlineframe" src="http://[@IP_SolarWinds]/Orion/Login.aspx?AccountID=[USER]&Password=[PASSWORD]" frameborder="0" scrolling="auto" width="0" height="0" marginwidth="0" marginheight="0" ></iframe>
- Session's account never expire.
- use "php timer" w/ (sleep) to the connection.
<iframe name="I1" src="http://[@IP_SolarWinds]/Orion/DetachResource.aspx?ResourceID=1979&NetObject=" frameborder="0" scrolling="auto" width="500" height="320" marginwidth="5" marginheight="5" id="I1" ></iframe>
- Here My ressources, maps, group, list groups,...
it's not a final solution for me.
-
68. Re: Orion SDK Information
jmiddleton Feb 20, 2014 9:58 AM (in response to derhally)I'm attempting to add and also update information in the Orion.WorldMap.Point table, do you happen to have any pointers on how to do it? Ideally via perl.
Update: create a post with the question - Updating Orion.WorldMap.Point via the Perl SDK
-
-
70. Re: Orion SDK Information
jswan Feb 26, 2014 3:40 PM (in response to bshopp)The Python sample code included with the SDK has some typo-bugs in it: .json() is a method of the request object, not an attribute, so ()s are required but not included. I posted a fixed, slightly more friendly version here:
-
71. Re: Orion SDK Information
tdanner Feb 26, 2014 4:19 PM (in response to jswan)Thanks, Jay! Mind if I use this in the next SDK release?
-
72. Re: Orion SDK Information
jswan Feb 27, 2014 9:06 AM (in response to tdanner)Please do! I was thinking about adding an option to print the details of the request object in each example. I'll update the gist as I have time, but feel free to do whatever you like with it.
-
73. Re: Orion SDK Information
Craig NorborgJun 3, 2014 1:23 PM (in response to bshopp)
Been trying to get IsNull to work under both 1.8 and now 1.9, but I'm getting an error. I'm curious if its actually working or not. Most keywords in SWQL Studio (like SELECT, FROM) end up being highlighted in blue. When I type in IsNull, it stops being blue when I get to the "IsN" point. When I type in the "N" the whole word I'm typing in goes from black to blue. I couldn't think of any keywords that start with "IS" (except for maybe "IS" itself), so I started fooling around and the only combination that keeps the text highlighted blue is "ISA", but nothing beyond that?
So, I'm curious, is IsNull() working? Is it a problem that it isn't staying highlighted in the SWQL studio?
And just out of curiosity, why is "ISA" highlighted?
-
74. Re: Re: Orion SDK Information
tdanner Jun 3, 2014 1:37 PM (in response to Craig Norborg)SWQL Studio has a hard-coded list of keywords to highlight. ISNULL isn't in the list, though it should be. Don't read too much into it. ISNULL works fine with SWIS.
"ISA" is a keyword that gets highlighted because it is in SWQL Studio's list. This is an operator in SWQL that doesn't really have a direct equivalent in SQL. It's a boolean operation on types. It tells you whether the left operand is the same as or a subtype (direct or indirect) of the right operand. Example usage:
SELECT FullName FROM Metadata.Entity WHERE FullName ISA 'System.ManagedEntity'