9 Replies Latest reply on Jul 14, 2016 10:56 AM by tdanner

    Problem with CreateCorePluginConfiguration

    lawrencellui

      I'm trying to start automating the process of node autodiscovery.  Looks like the 1st part is to generate a config with CreateCorePluginConfiguration.  When invoke this, I get the following error message:

       

      {'Message': 'Verb Orion.Discovery.CreateCorePluginConfiguration cannot unpackage parameter 0'}

       

      This is my python code:

      def main():

          swis = SwisClient('localhost', 'admin', '')

          config = swis.invoke('Orion.Discovery', 'CreateCorePluginConfiguration',

          {

            'BulkList': [{'Address':'10.199.10.12'}],

            #'IpRanges': [], # Optional

            #'Subnets': None, # Optional

            'Credentials': [

              {'CredentialID':1, 'Order':1},

              {'CredentialID':2, 'Order':2},

            ],

            'WmiRetriesCount': 1,

            'WmiRetryIntervalMiliseconds': 1000

          })

       

      I'm running the following:

      Orion 2013.2.0, NPM 10.6

       

      Thanks,

      Larry

       

        • Re: Problem with CreateCorePluginConfiguration
          jmiddleton

          I can't spot any errors, the Python code I have looks the same and functions. However I've only tested against 11.5 and 12.0RC1.

           

          May be it's down to your version of Orion? It may be worth spinning up a test system of 12.0RC1 and testing. It'll also mean that you can try NetPath which is looking really cool.

           

          Could be that version is not liking the missing other values, you could include them with the defaults that NPM likes.

           

          Which are as follows:

           

          BulkList = None
          IpRanges = []
          Subnets = None
          CredIDs = []
          CorePluginConfiguration = self.invoke('Orion.Discovery',
                                                'CreateCorePluginConfiguration',
                                                {'BulkList': BulkList,
                                                 'IpRanges': IpRanges,
                                                 'Subnets': Subnets,
                                                 'Credentials': CredIDs,
                                                 'WmiRetriesCount': 0,
                                                 'WmiRetryIntervalMiliseconds': 1000})
          
            • Re: Problem with CreateCorePluginConfiguration
              nigel_sw

              Is the list of CredIDs simply a list of credential IDs (and not a dictionary of KVPs including 'Order')? I am currently trying to get a script running and am doing some debugging. I am passing a list of credential IDs e.g.

               

              ['41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '68', '69', '79', '83', '87', '91', '92', '99', '100', '101']

               

              I am on 11.5 and we are planning to make the jump soon, so if this isn't it I'm going to shelf this until I can get the upgrade complete next month.

                • Re: Problem with CreateCorePluginConfiguration
                  tdanner

                  The "Credentials" field should be a list of objects with two properties: CredentialID and Order. Like this:

                   

                  CredIDs = [ {'CredentialID': 41, 'Order': 1}, {'CredentialID': 42, 'Order': 2} ]

                   

                  etc.

                    • Re: Problem with CreateCorePluginConfiguration
                      nigel_sw

                      Order being the order in which the credentials are tried? I am not seeing that field in Orion.Credential...

                       

                      So basically I could use a for loop to create my list of dictionaries with an incrementer for the Order value? Would it be worth defining order in a more logical way? We have about 25 SNMP credentials that I will just pass to the cfg by default.

                        • Re: Problem with CreateCorePluginConfiguration
                          tdanner

                          Yes, it's the order they are tried. If you don't care, just increment the order for each one (you'll get an error if you have duplicate values for order). But with that many credentials your discovery will complete faster if you can put the most commonly used ones first.

                            • Re: Problem with CreateCorePluginConfiguration
                              nigel_sw

                              I realized after I asked how trivial it would be to pull get this information and export it to a csv. Here's the code I used for anyone in the future that wants to know how often their SNMP credentials are being used:

                               

                              swis = SwisClient(hostname, username, password)

                               

                              writer = csv.writer(open("C:\\Spreadsheets\\communityresults.csv", 'wb'))

                               

                              communitydict = {}

                               

                              def Main():

                                  communityresults = swis.query("""    SELECT n.Community

                                                  FROM Orion.Nodes n

                                                  WHERE n.Community IS NOT NULL AND n.Community!=''""")

                               

                                  for ro in communityresults['results']:

                                      communitystring = ro['Community']

                                      if communitystring in communitydict:

                                          communitydict[communitystring] += 1

                                      else:

                                          communitydict[communitystring] = 0

                                 

                                  for key in communitydict:

                                      rowlist = (str(key), str(communitydict[key]))

                                      print rowlist

                                      writer.writerow(rowlist)

                    • Re: Problem with CreateCorePluginConfiguration
                      tdanner

                      In this older version some verbs with complex arguments are not working over the REST API. They do work over PowerShell and SOAP. See this thread, for example: Re: 10.4.1 - use of Orion.Discovery verbs

                       

                      But jmiddleton is right - try NPM 12 if you can - it is way better.