solarwinds / OrionSDK

SDK for the SolarWinds Orion platform, including tools, documentation, and samples in PowerShell, C#, Go, Perl, and Java.
https://thwack.com/OrionSDK
Apache License 2.0
397 stars 139 forks source link

SNMPv3 Node Discovery with Read-Only Credentials #276

Open pvik opened 3 years ago

pvik commented 3 years ago

I am following the Node discovery example, but am trying to use the CredentialID as a Read-Only credential set.

While the node discovery completes, it ends up adding the node as an ICMP node, and I am having to go into Orion UI, and explicitly change the polling method and use the same credential set I had used from the API call in the Read-Only saved credential drop down, and everything works then.

Is it possible to specify the CredentialID being used should be a Read-Only credentials while invoking the CreateCorePluginConfiguration ?

Or even if I could change the polling method and set the RO CredentialID after the ICMP node gets added, that would work too, but from what I can see the API does not support changing the polling method of a node.

danjagnow commented 3 years ago

Or even if I could change the polling method and set the RO CredentialID after the ICMP node gets added, that would work too, but from what I can see the API does not support changing the polling method of a node.

You might want to vote for this feature request: API Verb to Change Polling Method

pvik commented 3 years ago

Thanks @danjagnow

Is there anyway to Add an SNMPv3 node using just RO Credentials from the API? Looks like we can't do this from a discovery job, and creating a node by HTTP/POST to /Create/Orion.Nodes doesn't allow me to use a saved CredentialID

I could still salvage this and explicitly specify all the SNMPv3 credential fields via a manual node create if I can pull all the credential fields from a saved SNMPv3 credential, which I have failed to do so far. I can see the SNMPv3 credential detail on existing nodes (from the Orion.SNMPv3Credentials table, but unable to retrieve the same for saved credentials.

Edit to add:

If there is an existing node that is using the credentials from a saved CredentialID, I seem to be able to retrieve the SNMPv3 Credentials via this query:

SELECT TOP 1 NodeID, Username, Context, PrivacyMethod, PrivacyKey, PrivacyKeyIsPassword, AuthenticationMethod, AuthenticationKey, AuthenticationKeyIsPassword, RWUsername, RWContext, RWPrivacyMethod, RWPrivacyKey, RWPrivacyKeyIsPassword, RWAuthenticationMethod, RWAuthenticationKey, RWAuthenticationKeyIsPassword, DisplayName, Description, InstanceType, Uri, InstanceSiteId
  FROM Orion.SNMPv3Credentials
  WHERE NodeID IN (
    SELECT NodeID
      FROM Orion.NodeSettings
      WHERE SettingName = 'ROSNMPCredentialID'
      AND SettingValue = <CredentialID>
)

This still seems like a very kludgey way to have to add a node via API :(

ifoughal commented 3 years ago

has this been fixed? for me I can't even parse the SettingName to the api as it rejectes the field completely and I'm not sure why...