Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

Adding nodes unsing SNMPv#3 (what am I doing wrong)?

$
0
0

Adding nodes using SNMPv2 has been easy since there are node properties that can be set, but when using SNMPv3 there are linked properties and I am not sure how to code this correctly.

 

With SNMPv2 I do this:

            SWIS.dictionary props = new SWIS.dictionary()

            {

                { new SWIS.item { key = "IpAddress", value = asset.MgmtIpAddress, type = "System.String" } },

                { new SWIS.item { key = "IPAddressGUID", value = ConvertIpToIpGuid(asset.MgmtIpAddress), type = "System.Guid" } },

                { new SWIS.item { key = "Caption", value = asset.Hostname, type = "System.String" } },

                { new SWIS.item { key = "DynamicIP", value = false, type = "System.Boolean" } },

                { new SWIS.item { key = "EngineID", value = 1, type = "System.Int32" } },

                { new SWIS.item { key = "Vendor", value = asset.Vendor, type = "System.String"} },

                { new SWIS.item { key = "PollInterval", value = 120, type = "System.Int32"} },

                { new SWIS.item { key = "StatCollection", value = 2, type = "System.Int32"} },

                { new SWIS.item { key = "Community", value = community, type = "System.String"} },

                { new SWIS.item { key = "ObjectSubType", value = "SNMP", type = "System.String"} },

                { new SWIS.item { key = "SNMPVersion", value = 2, type = "System.Int32"} },

                { new SWIS.item { key = "Status", value = 1, type = "System.Int32"} },

                { new SWIS.item { key = "UnManaged", value = false, type = "System.Boolean"} },

                { new SWIS.item { key = "Allow64BitCounters", value = true, type = "System.Boolean" } },

                { new SWIS.item { key = "SysObjectID", value = String.Empty, type = "System.String"} },

                { new SWIS.item { key = "VendorIcon", value = String.Empty, type = "System.String"} }

            };

 

            return Create("Orion.Nodes", props);

 

So for SNMPv3 I tried this:

            SWIS.dictionary snmpv3Creds = new SWIS.dictionary()

            {

                new SWIS.item { key = "AuthenticationKey", value = "asdfghjkl", type = "System.String" },

                new SWIS.item { key = "AuthenticationMethod", value = "SHA1", type = "System.String" },

                new SWIS.item { key = "Context", value = String.Empty, type = "System.String" },

                new SWIS.item { key = "PrivacyKey", value = "zxcvbnm,./", type = "System.String" },

                new SWIS.item { key = "PrivacyMethod", value = "AES128", type = "System.String" },

                new SWIS.item { key = "Username", value = "User", type = "System.String" }

            };

 

            SWIS.dictionary props = new SWIS.dictionary()

            {

                { new SWIS.item { key = "IpAddress", value = asset.MgmtIpAddress, type = "System.String" } },

                { new SWIS.item { key = "IPAddressGUID", value = ConvertIpToIpGuid(asset.MgmtIpAddress), type = "System.Guid" } },

                { new SWIS.item { key = "Caption", value = asset.Hostname, type = "System.String" } },

                { new SWIS.item { key = "DynamicIP", value = false, type = "System.Boolean" } },

                { new SWIS.item { key = "EngineID", value = 1, type = "System.Int32" } },

                { new SWIS.item { key = "Vendor", value = asset.Vendor, type = "System.String"} },

                { new SWIS.item { key = "PollInterval", value = 120, type = "System.Int32"} },

                { new SWIS.item { key = "StatCollection", value = 2, type = "System.Int32"} },

                { new SWIS.item { key = "ObjectSubType", value = "SNMP", type = "System.String"} },

                { new SWIS.item { key = "SNMPVersion", value = 3, type = "System.Int32"} },

                { new SWIS.item { key = "Status", value = 1, type = "System.Int32"} },

                { new SWIS.item { key = "UnManaged", value = false, type = "System.Boolean"} },

                { new SWIS.item { key = "Allow64BitCounters", value = true, type = "System.Boolean" } },

                { new SWIS.item { key = "SysObjectID", value = String.Empty, type = "System.String"} },

                { new SWIS.item { key = "VendorIcon", value = String.Empty, type = "System.String"} },

               { new SWIS.item { key = "SNMPv3Credentials", value = snmpv3Creds, type = "Orion.SNMPv3Credentials"} },

            };

 

            return Create("Orion.Nodes", props);

 

What is the correct way to add devices that use SNMP v3?

 

Some additional information.

 

As part of the process, after adding the node I add set all of our custom properties, add vendor specific pollers, and discover interfaces and add them.


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>