Open packetmagic opened 4 years ago
I am experiencing the same issue in Python.
` def createDiscovery(network, networks, number): orion_engine_id = 2 # Designate a specific engine to complete discovery snmpDiscoveryCreds = getCreds()
district = networks[network][2]
subnet = list(networks[network])
# If CIDR
if networks[network][3]:
sub = {
'SubnetIP' : networks[network][0],
'SubnetMask' : networks[network][1]
}
corePluginContext = {
'Subnets' : [sub],
'Credentials' : snmpDiscoveryCreds,
'WmiRetriesCount' : 0,
'WmiRetryIntervalMiliseconds' : 1000,
'IsDiscoveryForVimEnabled' : False
}
# If range
else:
iprange = {
'StartAddress' : networks[network][0],
'EndAddress' : networks[network][1]
}
corePluginContext = {
'IpRanges' : [iprange],
'Credentials' : snmpDiscoveryCreds,
'WmiRetriesCount' : 0,
'WmiRetryIntervalMiliseconds' : 1000,
'IsDiscoveryForVimEnabled' : False
}
interfacePluginContext = {
'AutoImportStatus': ['Up'] # Also available: Down, Shutdown
}
# Create core PluginConfigurationItem for Orion
corePluginConfig = swis.invoke('Orion.Discovery', 'CreateCorePluginConfiguration', corePluginContext)
# Create interface PluginConfigurationItem for Orion
interfacePluginConfig = swis.invoke('Orion.NPM.Interfaces', 'CreateInterfacesPluginConfiguration', interfacePluginContext)
# Assign name to profile
if number < 10:
name = '00'+ str(number) +' - ' + district + ' - ' + network
elif number < 100:
name = '0'+ str(number) +' - ' + district + ' - ' + network
else:
name = str(number) +' - ' + district + ' - ' + network
print(name)
# Generate profile
discoveryProfile = {
'Name': name,
'EngineID': orion_engine_id,
'JobTimeoutSeconds': 28800,
'SearchTimeoutMiliseconds': 5000,
'SnmpTimeoutMiliseconds': 5000,
'SnmpRetries': 2,
'RepeatIntervalMiliseconds': 1800,
'SnmpPort': 161,
'HopCount': 0,
'PreferredSnmpVersion': 'SNMP2c',
'DisableIcmp': True,
'AllowDuplicateNodes': False,
'IsAutoImport': True,
'IsHidden': False,
'PluginConfigurations': [{'PluginConfigurationItem': corePluginConfig}, {'PluginConfigurationItem': interfacePluginConfig}]
}
return discoveryProfile`
Apparently this is a bug introduced in 2019.4 version. We used this feature and worked well in 2019.2
I know this is old but I working on a discovery script for solarwinds and was stuck on this same issue all day. The command actually works fine, I discovered me, you and bunch of other people were just setting up the xml wrong. If you want to pass multiple plugin configurations it needs to look like the following:
<PluginConfigurations>
<PluginConfiguration>
<PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
</PluginConfiguration>
<PluginConfiguration>
<PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>
</PluginConfiguration>
</PluginConfigurations>
Setting the InterfacesDiscoveryPluginContext doesn't appear to actually do anything. The discovery works but does not select interfaces based on the option set in InterfacesDiscoveryPluginContext.
When I edit the discovery in the GUI the interface selection settings do not match those set in the code.
Running 2019.4