cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 11

How do we programmatically discover the non-interface properties [in Orion] and enable them

Jump to solution

We are automating the hydration of assets in Orion, and after adding a node, we know how to discover the interfaces, but how do we programmatically discover the non-interface properties and enable them like the sample below?Orion interface discovery ss.png


Thanks,

Scott F.


Tags (3)
1 Solution
Level 16

for all except hardware health you add the right set of pollers for the device.

        $swis->Create("Orion.Pollers", {

        'PollerType'=>$poller,

        'NetObject'=>"N:$node",

        'NetObjectType'=>'N',

        'NetObjectID'=>$node

        });

Here's a list of the (current) pollers.

N.MulticastRouting.SNMP.MulticastRoutingTable

N.Routing.SNMP.Ipv4CidrRoutingTable

N.Routing.SNMP.Ipv4RoutingTable

N.Routing.SNMP.Ipv6RoutingTable

N.RoutingNeighbor.SNMP.BGP

N.RoutingNeighbor.SNMP.OSPF

N.RoutingNeighbor.SNMP.OSPFv3

N.RoutingNeighbor.SNMP.OSPFv3Juniper

N.Topology_CDP.SNMP.cdpCacheTable

N.Topology_Layer2.SNMP.Dot1dTpFdb

N.Topology_Layer2.SNMP.Dot1dTpFdbNoVLANs

N.Topology_Layer2.SNMP.Dot1qTpFdbNoVLANs

N.Topology_Layer3.SNMP.ipNetToMedia

N.Topology_Layer3_IpRouting.SNMP.ipCidrRouter

N.Topology_Layer3_IpRouting.SNMP.rolesRouter

N.Topology_LLDP.SNMP.lldpRemoteSystemsData

N.Topology_PortsMap.SNMP.Dot1dBase

N.Topology_PortsMap.SNMP.Dot1dBaseNoVLANs

N.Topology_PortsMap.SNMP.Dot1qVlanEgressPorts

N.Topology_PortsMap.SNMP.JuniperExVlan

N.Topology_STP.SNMP.Dot1dStp

N.Topology_Vlans.SNMP.Dot1q

N.Topology_Vlans.SNMP.JuniperExVlan

N.Topology_Vlans.SNMP.VmMembershipSummary

N.Topology_Vlans.SNMP.VtpVlan

N.VRFRouting.SNMP.JuniperObsolete

N.VRFRouting.SNMP.JuniperStandard

N.VRFRouting.SNMP.MPLSVPNObsolete

N.VRFRouting.SNMP.MPLSVPNStandard

[I haven't found a way to determine which pollers should be added, I turn up what I need for a node, then look to see what pollers got added]

View solution in original post

40 Replies
Level 16

for all except hardware health you add the right set of pollers for the device.

        $swis->Create("Orion.Pollers", {

        'PollerType'=>$poller,

        'NetObject'=>"N:$node",

        'NetObjectType'=>'N',

        'NetObjectID'=>$node

        });

Here's a list of the (current) pollers.

N.MulticastRouting.SNMP.MulticastRoutingTable

N.Routing.SNMP.Ipv4CidrRoutingTable

N.Routing.SNMP.Ipv4RoutingTable

N.Routing.SNMP.Ipv6RoutingTable

N.RoutingNeighbor.SNMP.BGP

N.RoutingNeighbor.SNMP.OSPF

N.RoutingNeighbor.SNMP.OSPFv3

N.RoutingNeighbor.SNMP.OSPFv3Juniper

N.Topology_CDP.SNMP.cdpCacheTable

N.Topology_Layer2.SNMP.Dot1dTpFdb

N.Topology_Layer2.SNMP.Dot1dTpFdbNoVLANs

N.Topology_Layer2.SNMP.Dot1qTpFdbNoVLANs

N.Topology_Layer3.SNMP.ipNetToMedia

N.Topology_Layer3_IpRouting.SNMP.ipCidrRouter

N.Topology_Layer3_IpRouting.SNMP.rolesRouter

N.Topology_LLDP.SNMP.lldpRemoteSystemsData

N.Topology_PortsMap.SNMP.Dot1dBase

N.Topology_PortsMap.SNMP.Dot1dBaseNoVLANs

N.Topology_PortsMap.SNMP.Dot1qVlanEgressPorts

N.Topology_PortsMap.SNMP.JuniperExVlan

N.Topology_STP.SNMP.Dot1dStp

N.Topology_Vlans.SNMP.Dot1q

N.Topology_Vlans.SNMP.JuniperExVlan

N.Topology_Vlans.SNMP.VmMembershipSummary

N.Topology_Vlans.SNMP.VtpVlan

N.VRFRouting.SNMP.JuniperObsolete

N.VRFRouting.SNMP.JuniperStandard

N.VRFRouting.SNMP.MPLSVPNObsolete

N.VRFRouting.SNMP.MPLSVPNStandard

[I haven't found a way to determine which pollers should be added, I turn up what I need for a node, then look to see what pollers got added]

View solution in original post

After talking with the boss, the question we're really trying to ask is, when I hit the List Resources button from the Management pane of a Node Details screen, what's going on in the background, and more importantly, do we have the ability, via the SDK/API, to do the same thing(s) ?

For instance, we don't want to add 58+ pollers to any one device just because we don't know which ones go with said device. It seems like List Resources knows how to get just those interfaces/VLANs/etc. that go with the selected Node/device.

Thanks!

Hi,

Provided below the powershell script to discover and import results. This is for automatic discovery.

In order to add a node via SDK and all the resources of it needs to be discovered and added automatically, follow the below provided steps.

In case you need to add a resource that is not found in discovery (like non interface resources), you can added the specific poller to the node and rediscover to see that resource on the UI (As mentioned by Richard Letts).

#Step 1) Create Core plugin Configuration - IP ranges, subnets, IP bulk list, credentials

# You can provide the desired IPs or IP Ranges or Subnets as in the UI with already configured credentials.

# Query Orion.Credential to get the desired Credential ID

$xmlParam = ([xml]"

<CorePluginConfigurationContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>

<BulkList>

<IpAddress>

<Address>10.199.3.1</Address>

</IpAddress>

<IpAddress>

<Address>10.199.2.22</Address>

</IpAddress>

<IpAddress>

  <Address>2001:1:0:104:250:56ff:fe90:68dd</Address>

  </IpAddress>          

</BulkList>

<IpRanges>

<IpAddressRange>

  <StartAddress>10.199.1.1</StartAddress>

  <EndAddress>10.199.2.1</EndAddress>

</IpAddressRange>

</IpRanges>

<Subnets/>

<Credentials>     

<SharedCredentialInfo>

  <CredentialID>4</CredentialID>

<Order>1</Order>

</SharedCredentialInfo>   

<SharedCredentialInfo>

  <CredentialID>2</CredentialID>

<Order>2</Order>

</SharedCredentialInfo> 

<SharedCredentialInfo>

  <CredentialID>1</CredentialID>

<Order>3</Order>

</SharedCredentialInfo>   

<SharedCredentialInfo>

<CredentialID>5</CredentialID>

<Order>4</Order>

</SharedCredentialInfo> 

</Credentials>

<WmiRetriesCount>1</WmiRetriesCount>

  <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>

</CorePluginConfigurationContext>"

).DocumentElement

$coreCfg = Invoke-SwisVerb $SWIS_Connection "Orion.Discovery" "CreateCorePluginConfiguration" @($xmlParam)

$coreCfgText = $coreCfg.InnerXml

#--------------------------------------------------------------------------------------------------

#Step 2) Create VIM plugin Configuration

$vimParam = ([xml]"

<VimPluginConfigurationContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/VIM'>

<Enabled>true</Enabled>

<Credentials>

<SharedCredentialInfo>

  <CredentialID>3</CredentialID>

</SharedCredentialInfo>

</Credentials>

</VimPluginConfigurationContext>"

).DocumentElement

$vimCfg = Invoke-SwisVerb $SWIS_Connection "Orion.VIM.Discovery" "CreateVimPluginConfiguration" @($vimParam)

$vimCfgText = $vimCfg.InnerXml

#--------------------------------------------------------------------------------------------------

#Step 3) Create Discovery Configuration

# You can modify various parameters like Engine ID, SNMPPort,.. based on your environment

 

$startDiscoveryParam = ([xml]@("

<StartDiscoveryContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>

<Name>AutomaticDiscovery1</Name>

<EngineId>1</EngineId>

<JobTimeoutSeconds>3600</JobTimeoutSeconds>

<SearchTimeoutMiliseconds>2000</SearchTimeoutMiliseconds>

<SnmpTimeoutMiliseconds>2000</SnmpTimeoutMiliseconds>

<SnmpRetries>1</SnmpRetries>

<RepeatIntervalMiliseconds>1500</RepeatIntervalMiliseconds>

<SnmpPort>161</SnmpPort>

<HopCount>0</HopCount>

<PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>

<DisableIcmp>false</DisableIcmp>

<AllowDuplicateNodes>false</AllowDuplicateNodes>

<IsAutoImport>true</IsAutoImport>

<IsHidden>false</IsHidden>

<PluginConfigurations>",

"<PluginConfiguration>

<PluginConfigurationItem>$coreCfgText</PluginConfigurationItem>

</PluginConfiguration>",

"<PluginConfiguration>

<PluginConfigurationItem>$vimCfgText</PluginConfigurationItem>

</PluginConfiguration>",

"</PluginConfigurations>

</StartDiscoveryContext>"

)).DocumentElement   

    Invoke-SwisVerb $SWIS_Connection "Orion.Discovery" "StartDiscovery" @($startDiscoveryParam) | Out-Null

Hi @madhavan ,

I have two questions:

1. When I am trying to get the resources list of a node, I was unable to get the resources list of a node.

Below is the script that I tried to get resources list of a node

jobid = swis.invoke('Orion.Nodes', 'ScheduleListResources',NodeID)

print(jobid) time.sleep(60)

while True:

     results = swis.invoke('Orion.Nodes', 'GetScheduledListResourcesStatus', jobid,NodeID)

     print(results)

     if(results=='ReadyForImport'):

          break

results = swis.invoke('Orion.Nodes', 'ImportListResourcesResult', jobid,NodeID)

print(results)

Error when I run the script:

requests.exceptions.HTTPError: 400 Client Error: Could not load file or assembly 'SolarWinds.Interfaces.Discovery.Strings, Version=3.5.0.638, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. for url: https://solarwinds_url:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.Nodes/ImportListReso...

2. Is there a way to Enable monitoring for a specific volume of a node?

0 Kudos

I noticed the same error while working on ListResources.ps1 - Powershell script,

I got into below issues

Invoke-SwisVerb : Could not load file or assembly 'SolarWinds.Interfaces.Discovery.Strings, Version=3.5.0.638, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. At line:1 char:1 + Invoke-SwisVerb $swis "orion.nodes" "ImportListResourcesResult" @('b1 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1 + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

Noticed that that Swis ,it is looking for below application file, with  version '3.5.0.638' ,while actually we have a updated version '3.5.0.652' in Orion application files

Application file: SolarWinds.Interfaces.Discovery.Strings.dll

Path :C:\Program Files (x86)\SolarWinds\Orion\Interfaces.Discovery Current

Version : 3.5.0.652

 

I am also stopped right here..Can some one, help to solve the issues, please

0 Kudos
To add, I am using SAM. 2019.4.1, any pointers available
0 Kudos

Note: This has also been reported in GitHub at https://github.com/solarwinds/OrionSDK/issues/223.

0 Kudos

Hi @madhavan,

Question about using these discovery verbs in NPM 11.5.2.  Do you have to provide all of the xml information you list above even if the discovery is already present in the Discovery Profiles table?  I am just trying to automate running a discovery but powershell keeps throwing an error saying "StartDiscovery cannot unpackage parameter 0".  Here s a subset of my script:

$uri= Get-swisdata $swis "SELECT v.URI FROM Orion.DiscoveryProfiles AS V WHERE ProfileID= '146' "

$out=Invoke-SwisVerb $swis "Orion.Discovery" "StartDiscovery" @($uri) | out-null

I also may need another arguement for this verb but I can't find documentation on this verb to verify for sure.

thanks

0 Kudos

Hi,

If discovery profile is already present, you can use the StartDiscoveryProfile verb. It accepts discovery profile ID.

Invoke-SwisVerb $swis -EntityName "Orion.Discovery" -Verb "StartDiscoveryProfile" -Arguments @(1)

You can use swqlstudio for knowing about the list of verbs in an entity. You can also try invoking from swqlstudio to understand the parameters required to invoke the verb.

Thanks

0 Kudos

Hi, it is saying this verb is not found.  FYI, I can't find this verb listed under either Orion.Discovery or Orion.DiscoveryProfiles when I look in SWQLStudio.

Capture.PNG

0 Kudos

Hi,

Sorry. It is not available in NPM 11.5.2. It is under development and will be available in next major release. Right now you cannot start discovery using already created profiles from SDK.

Thanks

0 Kudos

Hello, madhavan​ .

Can you specify if StartDiscoveryProfile verb accepts profile ID for existing discovery in NPM 11.5.3 or it is implemented in NPM 12?

Thanks in advance for your reply.

0 Kudos

Roger. please tell the PMs imprved integration of the discovery process with the SDK is a critical need in the product for large environments.

Little bit of an old post I know, and also excuse my lack of knowledge as I am still quite new to the SDK and don't have a ton of scripting/programming experience in my background.  I'm trying to find a way to automate cleaning up orphaned volumes.  There seem to be helpful verbs and swql data for cleaning up interfaces, but not a lot for volumes.

I write all of the below out not because you necessarily need to know all of it, but because I wanted to not only document the basic steps that I think should be taken for my own reference, but also to have others weigh in on whether or not this is the best, most efficient approach and maybe make suggestions on how to improve one or many of these steps.

Mostly, I originally replied to ask a single question though.  madhavan, in your reply above that contains the "powershell script to discover and import results" I don't actually see how the script imports the results?  It creates and starts a discovery, but then the script just ends.  Did it get cut off or is there something obvious I'm missing?

Anyways, I came across this post while researching the automation of fixing orphaned volumes, mostly because my thinking is that I will need to do the following (I will be using powershell to accomplish this):

  • query swql for a list of volumes that are not responding and whose index is equal to 0 (this is the way I identify them in my custom report, so if there is a better indicator of orphaned volumes, please let me know).
  • Then, run a discovery up against the nodes that have orphaned volumes from the previous query (because this post seems to indicate there is no way to programmatically do a List Resources against each node using the SDK).
  • Import the Volumes found in this discovery (The best way I can think to do this would be to:)
    • query the DiscoveredVolumes table and compare the first 3 characters of the volumes found there against the orphaned volumes where the Node Name and/or IP match as well as the drive letter matches (I'm only concerned with Windows volumes at this point) but the label can be different (a SubString function in SWQL seems to be able to allow me to just compare the first 3 characters).  Also, I'm not exactly sure how to match items in there since the Node and Volume ID's that the DiscoveredVolumes and DiscoveredNodes tables have in no way match the actual NodeID and VolumeID numbers of nodes and volumes previously imported into the Orion database.  I imagine I can use the GetDiscoveryProgress verb to get some info about the discovery right after it was started, including the ProfileID, then, once it completes, only compare Volumes in that Profile to my orphaned results?
    • Then (and this is where I'm not sure what to do as well) import just the Volumes from this discovery (I'm not concerned with anything else that the discovery found, just the matching orphaned volumes that have ":\" in the caption).  I know there is an ImportDiscoveryResults verb, and I see the info in the Metadata.VerbArguments table, but I'm not really sure how to use it as the verb arguments don't exactly clear up a lot of mystery for a noob like me...
  • Next would be to delete the old orphaned volumes, however I would want to do another check here to verify I'm only deleting orphaned volumes where a new matching drive letter was imported to replace them.  In other words, if drives C:\ D:\ and E:\ were orphaned on a Node, but the discovery only found new versions of C:\ and D:\ on that Node, I would not want the script to delete drive E:\, since nothing replaced it.  It should only delete the old C:\ and D:\.  Drive E:\ can maybe be logged or have its Comments custom property updated to state that the script could not find a replacement volume for it and that a user should manually investigate it.

Sorry for the length of this, like I said, this was mostly just to ask a question (at first) and then to document the steps while I was thinking about them, and if it helps someone else that needs the same thing, then cool, that's a bonus.

Thanks!

Jordan

0 Kudos

Hi,

Your method for finding the orphaned volumes looks correct.

Removing a orphaned volume from the system

use the below provided powershell script. This will work for volumes that are already added to the system.

$uris = Get-SwisData $swis "Select Uri from Orion.Volumes where VolumeIndex = 0 and VolumeResponding = 'N'"

$uris | Remove-SwisObject $swis


ImportDiscoveryResults


Discovery is a 2 step process - Discover and Import.


Discover - Discovers all the interfaces, volumes for nodes to be discovered. Once the discovery is complete, you can see the discovered nodes, volumes, interfaces in the corresponding entities Orion.DiscoveredNodes, Orion.DiscoveredVolumes and Orion.DiscoveredInterfaces.

Import - Imports all the discovered details to the system for monitoring.


In the script provided in this thread, you can see an entry <IsAutoImport>true</IsAutoImport> in StartDiscoveryContext. This entry determines whether Import should happen immediately after Discovery or will be imported manually later.


ImportDiscoveryResults verb is used here, provide the profile id and also nodes to be imported (incase you need to import specific nodes) and invoke the verb so import happens.


I don't think removing orphaned volumes has nothing to do with discovery. But if you want to filter some discovered volumes / interfaces from import, you need to manually remove it from the discoveredVolumes, discoveredinterfaces database tables before invoking ImportDiscoveryResults verb (this operation is not advisable as it involves direct sql operation and not controlled by the product)




This is really great stuff madhavan.  I just didn't come across that info when I was searching for it.  Do you know this information from working with the SDK, know it as part of your job at SolarWinds, or find this stuff documented somewhere?  I know the SDK isn't "officially" supported and the documentation that comes with the SDK is great to get started, but I really struggle finding how to use a lot of the verbs and things like that.  Everyone always replies to peoples question about verb documentation with "Go to SWQL studio and look at the Metadata.VerbArguments entity table".  Well, I went and I looked at it and I still have no clue how to use 99% of the verbs I come across.

I wish I had the time to just fiddle with the stuff and figure it out myself, but unless its something that I HAVE to have to proceed in my work, I can't dedicate a ton of time to trial and error.  Having a solid source of documented information for the verbs (much like what you wrote above and what tdanner replied to me once regarding a custom property verb) would be amazing for those like me who need access to information to quickly solve a problem.

Thanks again!

I have the same question. I'm struggling to find documentation that explains the functionality of the Orion SDK along with examples on how to perform common tasks create reports, add/remove nodes, etc.

What wiki is really basic and raises more questions than it answers. 😕

0 Kudos

Your right the wki could synthesize alot of the good examples in the forums.  but if you look in the SDK forum on thwack you will find alot of good threads.  As always post a specific question on the forum.  @madhavan, alexslv​, and tdanner​ are really great along with many others.

0 Kudos

Thank you for a detailed explanation.  I will look at my discovery logs as even though I have tens of discoveries running each day, I am not seeing any data in some of these discovery tables.

0 Kudos

Hi,

Check the value of IsHidden in StartDiscoveryContext. If it is true, data from discovery tables will be removed once the discovery process is completed.

0 Kudos