4 Replies Latest reply on Feb 11, 2019 5:06 PM by mesverrum

    Creating UnDP through SWQL

    jpablo

      I've recently being using SWQL to query the Solarwinds DB in order to fetch data. Now I'm trying to create a UnDP through SWQL, using Python, but I keep receiving this error:

       

      Pointing to NodeCustomPoller Table:

      swis.create('Orion.NPM.NodeCustomPollers', **props)

       

      Traceback (most recent call last):

        File "<console>", line 1, in <module>

        File "/usr/lib/python2.7/site-packages/orionsdk/swisclient.py", line 34, in create

          "Create/" + entity, properties).json()

        File "/usr/lib/python2.7/site-packages/orionsdk/swisclient.py", line 59, in _req

          resp.raise_for_status()

        File "/usr/lib/python2.7/site-packages/requests/models.py", line 834, in raise_for_status

          raise HTTPError(http_error_msg, response=self)

      HTTPError: 403 Client Error: Operation not supported on Orion.NPM.NodeCustomPollers

       

      Pointing to CustomPoller Table:

      swis.create('Orion.NPM.CustomPollers', **props)

       

      Traceback (most recent call last):

        File "<console>", line 1, in <module>

        File "/usr/lib/python2.7/site-packages/orionsdk/swisclient.py", line 34, in create

          "Create/" + entity, properties).json()

        File "/usr/lib/python2.7/site-packages/orionsdk/swisclient.py", line 59, in _req

          resp.raise_for_status()

        File "/usr/lib/python2.7/site-packages/requests/models.py", line 834, in raise_for_status

          raise HTTPError(http_error_msg, response=self)

      HTTPError: 400 Client Error: Cannot create instances of abstract entity Orion.NPM.CustomPollers.

      Parameter name: entityType

       

      I've created the props parameter using the columns I've seen in both tables through SWQL Studio, for example in CustomPollers:

       

      props = {

          'DisplayName': None,

          'TimeUnitQuantity': 0,

          'NetObjectPrefix': 'N',

          'InstanceSiteId': 0,

          'Description': 'RPM',

          'PollerType': 'C',

          'PollInterval': 5,

          'InstanceType': 'Orion.NPM.NodeCustomPollers',

          'TimeUnitID': 0,

          'MIB': 'jnxRpmResultsSummaryTable',

          'IncludeHistoricStatistics': True,

          'Enabled': True,

          'DefaultDisplayTimeUnitID': 0,

          'CustomPollerParserID': 6,

          'SNMPGetType': 'Get',

          'GroupName': '_NOC',

          'OID': '1.3.6.1.4.1.2636.3.50.1.2.1.4.16.79.78.45.82.80.77.45.83.85.66.77.65.82.73.78.69.16.78.65.80.49.45.83.65.66.45.65.69.49.51.95.67.82.2',

          'UniqueName': 'ON-RPM',

      }

       

      I've also tried using fewer fields, even one by one, but keep receiving an error. Is it possible to create UnDP through SWQL?

        • Re: Creating UnDP through SWQL
          mesverrum

          Not every table allows you to just insert objects directly via SWQL, in fact most do not.  If there is a verb to do what you want then you should use the verb because that will ensure that the correct types of objects are created on related tables and that everything is kosher.  You can tell if a table supports different types of commands by opening it up in the latest releases of SWQL studio and hovering over the table name it has a tooltip that lets you know if create/update/delete operations are allowed or not.  I want to say that from past experience the UNDP tables did not support creates so In previous gigs i had to just write everything in using traditional SQL scripts.  I haven't heard of anything to indicate that has changed recently.