5 Replies Latest reply on Apr 16, 2014 11:28 AM by leinhard

    Executing CLI for NCM with Python language





      Hello, My name is David, Shin and Interested in the SDN and ACI for Cisco now,

      Tis interface can programable with the python language, also SolarWinds provide API for free with python support.

      to fullfill the functions from the another new customer requirements, should make a some script with python language.


      Let me know how to control solariwinds product with sdk plz.

      also we test the solarwinds API with Powershell, sample script works well,


      Not plan to use the solarwinds api to connect to the cisco devices directly,

      just want to use it connecting with the solarwinds NCM .


      Running python script via solarwinds api to the NCM then operate ncm control the each registered cisco and other network devices.

      hope to help understanding the concept.


      when i execute the sample python script in the SDK 1.8 following error was occured, i have no idea why this is happened

      i install the NPM 10.7 and NCM 7.2.2




      Best Regards

      David, Shin.

        • Re: Executing CLI for NCM with Python language

          Could you post your python code as text instead of a video?

            • Re: Executing CLI for NCM with Python language

              tdanner 님이 쓴 말:


              Could you post your python code as text instead of a video?

              thanks for response me

              Just hope to show how to execute it :-)

              surely possible to post the code,



              import requests

              import json



              class SwisClient:

                def __init__(self, hostname, username, password):

                self.url = "https://%s:17778/SolarWinds/InformationService/v3/Json/" % (hostname)

                self.credentials = (username, password)



                def query(self, query, **params):

                return self._req("POST", "Query", {'query': query, 'parameters': params}).json



                def invoke(self, entity, verb, *args):

                return self._req("POST", "Invoke/%s/%s" % (entity, verb), args).json



                def create(self, entity, **properties):

                return self._req("POST", "Create/" + entity, properties).json



                def read(self, uri):

                return self._req("GET", uri).json



                def update(self, uri, **properties):

                self._req("POST", uri, properties)



                def delete(self, uri):

                self._req("DELETE", uri)



                def _req(self, method, frag, data=None):

                return requests.request(method, self.url + frag,




                headers={'Content-Type': 'application/json'})



              def samplecode():

                swis = SwisClient("prugio", "admin", "")


                aliases = swis.invoke("Metadata.Entity", "GetAliases", "SELECT B.Caption FROM Orion.Nodes B")




                results = swis.query("SELECT Uri FROM Orion.Nodes WHERE NodeID=@id", id=1)

                uri = results['results'][0]['Uri']




                swis.update(uri + "/CustomProperties", city="Austin")

                obj = swis.read(uri + "/CustomProperties")




                pollerUri = swis.create("Orion.Pollers", PollerType="just testing",

                NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])