3 Replies Latest reply on Jun 15, 2017 9:49 AM by tomas.vrabel

    REST Delete/BulkDelete Operations for Orion.NPM.DiscoveredInterfaces/Orion.DiscoveredVolumes

    equalswql

      Hello tdanner / Orion SDK Community,

       

      In my automation workflow to discover/import nodes/interfaces/volumes, I'm setting autoimport to false so that I can filter out interfaces and volumes appropriately.

      I'm wanting to use the Delete and BulkDelete operations, however some tables don't seem to have a URI to reference the object I want to delete.

      Is there any other option other than URI? I was using something like the following :

       

      https://localhost:17778/SolarWinds/InformationService/v3/Json/swis://localhost/Orion.NPM/Orion.NPM.DiscoveredInterfaces/…

       

      but got the following response:

       

      {

        "Message": "Invalid key properties specified for entity Orion.NPM.DiscoveredInterfaces.\r\nParameter name: filter",

        "ExceptionType": "System.ArgumentException",

        "FullException": "System.ArgumentException: Invalid key properties specified for entity Orion.NPM.DiscoveredInterfaces.\r\nParameter name: filter\r\n   at SolarWinds.InformationService.Core.SwisUriResolver.ValidateAndResolveFilter(IEntityType entity, SwisUriFilter filter, Boolean isHosted)\r\n   at SolarWinds.InformationService.Core.SwisUriResolver.ValidateAndResolveUri(SwisUri uri, IQueryExecutionContext context)\r\n   at SolarWinds.InformationService.Core.CrudProcessor.Delete(SwisUri uri, IQueryExecutionContext context)\r\n   at SolarWinds.InformationService.Core.InformationService.Delete(String uri)"

      }

       

      I know the only other way to do this (that I know of at least, is to delete the associated objects in SQL directly).

       

      Any other way to do this with DELETE / BULKDELETE?

       

      Thank you,

       

      =swql

       

        • Re: REST Delete/BulkDelete Operations for Orion.NPM.DiscoveredInterfaces/Orion.DiscoveredVolumes
          tomas.vrabel

          Unfortunately seems like it's not possible to remove entries from Orion.NPM.DiscoveredInterfaces using Delete or BulkDelete. These methods require URI but entity type Orion.NPM.DiscoveredInterfaces does not have URI as there are no key(s) defined for this entity.

           

          As a workaround you can try following approaches:

          1) Please have a look at orionsdk-python/discover_and_add_interfaces.py at master · solarwinds/orionsdk-python · GitHub . This Python script discovers and adds interfaces for node. You can also filter discovered interfaces before adding them on node.

           

          2) Another approach is to add all discovered interfaces to node and remove specific ones from node afterwards. Interfaces on node can be removed using Delete operation as they already have URI.

           

          If none of these workarounds is suitable for you please explain related issues and I will try to figure out other solution.

           

          Just for my curiosity - which method do you use today to add discovered interfaces that are stored as Orion.NPM.DiscoveredInterfaces entities?

            • Re: REST Delete/BulkDelete Operations for Orion.NPM.DiscoveredInterfaces/Orion.DiscoveredVolumes
              equalswql

               

              Hello tomas.vrabel,

               

              Thank you for your response. In regards to your solutions/questions:

               

              Please have a look at orionsdk-python/discover_and_add_interfaces.py at master · solarwinds/orionsdk-python · GitHub . This Python script discovers and adds interfaces for node. You can also filter discovered interfaces before adding them on node.

              1) I understand the ability to use filters - however this is a "global" filter for the entire discovery - my filtering needs to be per node. Defining global filters that are common to all nodes would definitely help to cut out some of the "noise" - however I'd have to work out if there is anything that is never needed globally.

               

              Another approach is to add all discovered interfaces to node and remove specific ones from node afterwards. Interfaces on node can be removed using Delete operation as they already have URI.

              2) I've tried this method, however due to the huge list of interfaces that are imported, this introduces a lot of inefficiency as literally thousands of interfaces can temporarily spike polling on an individual poller.

               

              Just for my curiosity - which method do you use today to add discovered interfaces that are stored as Orion.NPM.DiscoveredInterfaces entities?

               

              To give you some context, I'm bulk copying nodes from one instance of solarwinds to another - There is already a powershell script out there which literally just moves information from one database to the other, however I think it is a better practice to use discovery as if versions change, new columns/tables may get changed/updated and information may be missed. Using a discovery ensures everything comes in correctly in my opinion.

               

              What I'm attempting to do is compare interfaces for an individual node on a SOURCE instance of solarwinds to the discovery results of a destination instance of solarwinds. Essentially, if I'm only monitoring 2 interfaces out of 1000 which belong to a node, I will do a query for the interface names on the source instance, compare it to the names of the interfaces connected to the node in question and delete all interfaces not matching that description within the context of the discovery results. After looping this for all nodes in the discovery, I can run the import - which will bring in only the interfaces I want.

               

              I'll end up doing this for volumes as well...

               

              To import I'm using Autoimport = 'false' in the discovery context, then using the 'ImportDiscoveryResults' verb after. This allows me to put a pause on the discovery after it completes, do specific filtering (deleting from various discovery tables via SQL) and then running the import.

               

              Basically, I already have this working but was looking for a solution to do bulk deletes through REST rather than through SQL.

               

              Thank you,

               

              =swql