27 Replies Latest reply on Mar 28, 2013 3:01 PM by tdanner

    Queries regarding Orion SDK

    mohit goel

      Hi,

       

      I am a newbie to Orion SDK . we actually want to implement/deploy SDK in our production environment. I had some queries..maybe some one can help me out..:

      - we are running NPM v10.3 and soon gonna be using Orion FoE(Failover engine),I hope SDK's latest version is compatible with it.

      - we have a inhouse developed CMDB, can SDK connect to that ?

      - also can you please redirect me to some release note or installation guide, to better understand Orion SDK

       

      Many thanks in advance.

       

      Regards,

      mohit

        • Re: Queries regarding Orion SDK
          tdanner

          1. The current version of the SDK works with NPM 10.3 and the failover engine.

          2. The tools and samples in the SDK connect to the Orion platform using a SolarWinds-proprietary protocol. They won't connect to your in-house CMDB. However, depending on what API your CMDB supports, it is probably possible to write a program that connects to both the Orion platform and your CMDB for coordinating the two systems.

          3. The documentation for the Orion SDK is included in the package. I recommend you just install it and look over the docs that way.

            • Re: Queries regarding Orion SDK
              mohit goel

              Hi..

               

              Thanks for replying.

              Can we write in python in Orion SDK ? I am asking this because when I

              installed the package then in the samples folder there were 4

              clients..java,perl,powershell,VB

               

              On Thu, Jan 3, 2013 at 9:39 AM, tdanner <

                • Re: Queries regarding Orion SDK
                  tdanner

                  In general, any language or runtime should be able to connect to the SolarWinds Information Service - you aren't restricted to the languages we provide samples for. You just need to choose a SOAP client toolkit for Python. I haven't tried that myself, but I would start with Suds.

                    • Re: Queries regarding Orion SDK
                      mohit goel

                      Thanks for quick reply......How should I connect to SWIS from here....

                       

                      image: Inline image 1

                       

                      On Fri, Jan 4, 2013 at 12:32 AM, tdanner <

                        • Re: Queries regarding Orion SDK
                          tdanner

                          In the "server name" field, put the host name for your Orion server. In the "server type field", choose "Orion (v3)". For the username and password fields, log in the same way you would log in to the Orion website.

                            • Re: Queries regarding Orion SDK
                              mohit goel

                              What's the difference between choosing Orion (v3) or Orion (v2)?

                              Also if suppose I want to connect to NPM through SDK, so what does this

                              exactly means? Is it that we will use a script that will make query the NPM

                              database using SWIS?

                               

                              Also, if above is true then where can this script run? only on Orion server

                              or can we also run it on any other UNIX host also? And how to run it on

                              Orion, can we schedule it or it has to be run manually?

                              Can you please point me to any script that connects to NPM and pulls out

                              information?

                               

                              Sorry some of the above question might seem silly, but I am very new to it.

                              Thanks in advance

                               

                              On Fri, Jan 4, 2013 at 9:52 PM, tdanner <

                    • Re: Queries regarding Orion SDK
                      RichardLetts

                      Install the SDK on a desktop system and read the documentation, including the examples.

                      The SDK is for the use of a programmer who understands REST/CRUD/SOAP -- the documentation is fairly clear on what it does.

                      I would advise installing it on a workstation and running any program you write against a  development/test instance.

                       

                      v2/v3: there are some verbs that only work on v3.

                      yes it can query the NPM database (examples included in the SDK)

                      the programs that use the SDK can tun anywhere with a network connection, on any platform, that can reach the Orion server. I run my [perl] programs on a RHEL linux system. If you've a powershell programmer, java programmer then they could get their programs to work on their platform of preference.

                        • Re: Queries regarding Orion SDK
                          mohit goel

                          Can somebody please help me in writing a small python script to connect to

                          NPM using SDK (or redirect to some documentation)

                           

                          On Mon, Jan 7, 2013 at 8:37 AM, RichardLetts <

                            • Re: Queries regarding Orion SDK
                              tdanner

                              Hopefully this will get you started. Install SUDS - I used this version: https://bitbucket.org/jurko/suds

                               

                              from suds.client import Client

                              url = 'https://localhost:17778/SolarWinds/InformationService/v3?wsdl'

                              swis = Client(url, username='admin', password='')

                              swis.set_options(port='BasicHttpBinding_InformationService')

                              x=client.service.QueryXml('SELECT Caption FROM Orion.Nodes')

                              for row in x.queryResult.data.row:

                                   print(row.c0)

                                • Re: Queries regarding Orion SDK
                                  sbrumley

                                  This is awesome, but the QueryXML is not working right for me.  I'm getting a ValueError: need more than 0 values to unpack.  Any ideas what I'm missing?  It appears to be some syntax or something.

                                   

                                  The line before the ValueError shows "suds/resolver.py", line 361, in findattr

                                   

                                  Thanks!!

                                    • Re: Queries regarding Orion SDK
                                      tdanner

                                      Are you using the script I sent or a modified version?

                                        • Re: Queries regarding Orion SDK
                                          sbrumley

                                          I'm using suds with the code from above. 

                                           

                                          It works great for a Read, but the QueryXml gives that error. 

                                           

                                          I'm still trying to figure out the proper syntax of the dictionary for Update to update custom properties.

                                            • Re: Queries regarding Orion SDK
                                              sbrumley

                                              #!/usr/local/bin/python

                                               

                                              url = "https://localhost:17778/SolarWinds/InformationService/v3?wsdl"

                                               

                                              ### Grab Info From Solarwinds

                                              from suds.client import Client

                                              client = Client(url, username='user', password='password')

                                              client.set_options(port='BasicHttpBinding_InformationService')

                                              # Print out Key

                                               

                                              ## READ

                                              nodeId = 1

                                              uri = "swis://localhost/Orion/Orion.Nodes/NodeID=" + str(nodeId) + "/CustomProperties"

                                              result = client.service.Read(uri)

                                              print result

                                               

                                               

                                              This works.  Just having trouble with Update and Custom Properties.  Probably syntax.

                                               

                                              Sincerely,

                                               

                                              Scott

                                                • Re: Queries regarding Orion SDK
                                                  tdanner

                                                  Update is a little more tricky because you need to provide a "dictionary" object with the properties to update, but it has nothing to do with a python dictionary - it's a custom structure defined in the WSDL for the service. In SUDS, you can use the factory to make instances of the dictionary and the "item" structures that it contains. This is the same kind of object that you would need to fill out to use the the SWIS Create method.

                                                   

                                                  Example code:

                                                   

                                                   

                                                  from suds.client import Client

                                                   

                                                  url = 'https://localhost:17778/SolarWinds/InformationService/v3?wsdl'

                                                  swis = Client(url, username='admin', password='')

                                                  swis.set_options(port='BasicHttpBinding_InformationService')

                                                  x=swis.service.QueryXml('SELECT TOP 1 Uri FROM Orion.Nodes')

                                                  uri = x.queryResult.data.row[0] + '/CustomProperties'

                                                  print(uri)

                                                   

                                                  d=swis.factory.create('ns4:dictionary')

                                                  i=swis.factory.create('ns4:item')

                                                  i.key="City"

                                                  i.type="System.String"

                                                  i.value='Austin'

                                                  d.item.append(i)

                                                   

                                                  swis.service.Update(uri, d)

                                                    • Re: Queries regarding Orion SDK
                                                      sbrumley

                                                      This syntax is helpful thanks.  I thought I would start off slow.  But I'm missing something.  I noticed the WSDL says the QueryXML syntax is QueryXml(xs:string query, ns4:dictionary parameters, )


                                                      Do I need to pass it an empty dictionary or None?  It didn't like the ways I tried to do that.

                                                       

                                                      ### Grab Info From Solarwinds

                                                      from suds.client import Client

                                                       

                                                       

                                                      url = "https://localhost:17778/SolarWinds/InformationService/v3?wsdl"

                                                      swis = Client(url, username='user', password='password')

                                                      swis.set_options(port='BasicHttpBinding_InformationService')

                                                       

                                                      x=swis.service.QueryXml('SELECT TOP 1 Uri FROM Orion.Nodes',None)

                                                      uri = x.queryResult.data.row[0] + '/CustomProperties'

                                                      print(uri)

                                                       

                                                       

                                                      #d=swis.factory.create('ns4:dictionary')

                                                      #i=swis.factory.create('ns4:item')

                                                      #i.key="node_runbook"

                                                      #i.type="System.String"

                                                      #i.value="Testing"

                                                      #d.item.append

                                                       

                                                      This produces:

                                                      [mb2178@cpliis4i solar]$ ./npm.py

                                                      Traceback (most recent call last):

                                                        File "./npm.py", line 15, in <module>

                                                          x=swis.service.QueryXml('SELECT TOP 1 Uri FROM Orion.Nodes',None)

                                                        File "build/bdist.linux-x86_64/egg/suds/client.py", line 228, in __call__

                                                        File "build/bdist.linux-x86_64/egg/suds/client.py", line 367, in call

                                                        File "build/bdist.linux-x86_64/egg/suds/client.py", line 228, in __call__

                                                        File "build/bdist.linux-x86_64/egg/suds/client.py", line 410, in call

                                                        File "build/bdist.linux-x86_64/egg/suds/client.py", line 468, in invoke

                                                        File "build/bdist.linux-x86_64/egg/suds/client.py", line 493, in send

                                                        File "build/bdist.linux-x86_64/egg/suds/client.py", line 525, in succeeded

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/binding.py", line 135, in get_reply

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 302, in process

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 87, in process

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 102, in append

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 156, in append_attributes

                                                        File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 389, in append_attribute

                                                        File "build/bdist.linux-x86_64/egg/suds/resolver.py", line 361, in findattr

                                                      ValueError: need more than 0 values to unpack

                                                        • Re: Queries regarding Orion SDK
                                                          sbrumley

                                                          Awesome!!   If I hard code the URI you dictionary model works perfectly.  Can you help me to figure out the QueryXml?

                                                           

                                                          Sincerely,

                                                           

                                                          Scott

                                                            • Re: Queries regarding Orion SDK
                                                              tdanner

                                                              If you don't need to pass any query parameters, you can just omit that argument to QueryXml. Like this:

                                                               

                                                              x=swis.service.QueryXml("SELECT TOP 1 Uri FROM Orion.Nodes WHERE Vendor='Cisco'")

                                                               

                                                              If you do want to use query parameters, you can provide them in a dictionary like this:

                                                               

                                                              d=swis.factory.create('ns4:dictionary')

                                                              i=swis.factory.create('ns4:item')

                                                              i.key="Vendor"

                                                              i.type="System.String"

                                                              i.value="Cisco"

                                                              d.item.append( i )

                                                               

                                                              x=swis.service.QueryXml("SELECT TOP 1 Uri FROM Orion.Nodes WHERE Vendor=@Vendor", d)

                                                            • Re: Queries regarding Orion SDK
                                                              tdanner

                                                              In my test, an empty dictionary worked fine (swis.factory.create('ns4:dictionary')) but None did not.

                                                                • Re: Queries regarding Orion SDK
                                                                  sbrumley

                                                                  Still getting

                                                                   

                                                                  [mb2178@cpliis4i solar]$ ./npm.py

                                                                  Traceback (most recent call last):

                                                                    File "./npm.py", line 30, in <module>

                                                                      x=swis.service.QueryXml("SELECT TOP 1 Uri FROM Orion.Nodes WHERE Vendor='Cisco'",d)

                                                                    File "build/bdist.linux-x86_64/egg/suds/client.py", line 228, in __call__

                                                                    File "build/bdist.linux-x86_64/egg/suds/client.py", line 367, in call

                                                                    File "build/bdist.linux-x86_64/egg/suds/client.py", line 228, in __call__

                                                                    File "build/bdist.linux-x86_64/egg/suds/client.py", line 410, in call

                                                                    File "build/bdist.linux-x86_64/egg/suds/client.py", line 468, in invoke

                                                                    File "build/bdist.linux-x86_64/egg/suds/client.py", line 493, in send

                                                                    File "build/bdist.linux-x86_64/egg/suds/client.py", line 525, in succeeded

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/binding.py", line 135, in get_reply

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 302, in process

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 87, in process

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 103, in append

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 180, in append_children

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 102, in append

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 156, in append_attributes

                                                                    File "build/bdist.linux-x86_64/egg/suds/bindings/unmarshaller.py", line 389, in append_attribute

                                                                    File "build/bdist.linux-x86_64/egg/suds/resolver.py", line 361, in findattr

                                                                  ValueError: need more than 0 values to unpack

                                                • Re: Queries regarding Orion SDK
                                                  mohit goel

                                                  Also I have installed Orion SDK v1.5, but in the documentation I could not

                                                  any explanation on the perl script example.Where can i see

                                                  about the perl documentation.