This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

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

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 :

localhost:17778/.../…

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

  • 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?

  • 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

  • Thank you, I understand your approach - there is no way how to filter interfaces during import so you want to remove them beforehand.

    Unfortunately currently it's not possible to delete entities from Orion.NPM.DiscoveredInterfaces using SDK and deleting them directly from DB is not right.

    It may be possible to leverage orionsdk-python/discover_and_add_interfaces.py at master · solarwinds/orionsdk-python · GitHub .

    The snippet shows how to discover interfaces for given node, filter them using simple filter and eventually import them. You can improve filtering logic and create advanced filtering logic in Python - e.g. read filter rules from external file, node-specific filters etc.

    Verb DiscoverInterfacesOnNode has timeout. Default timeout that may be not sufficient but can be adjusted in SolarWinds.Data.Providers.NPM.v3.dll.config file, located in ORION_INSTALL_PATH/InformationService/v3/Plugins.