PowerSNMP for .NET
from $1,199.00Available Platforms
A Superior SNMP .NET Class Library
Simple Network Management Protocol components seamlessly integrate threaded communications, security, and encoding/decoding so you can quickly develop custom SNMP applications. This development tool requires fewer resources, provides more flexibility, and elicits code that is easy to re-use and maintain. See our Programming Primer for detailed instructions.
//Create Agent, and Socket to send Inform from
Agent agent1 = new Agent();
SnmpSocket agentSocket = new SnmpSocket(agent1);
//Create an inform message, the 2nd value should be changed to the relevant OID
InformMessage inform = new InformMessage(agent1.SysUpTime, "1.3.6.1.4.42.3.1");
ResponseMessage response = agentSocket.GetResponse(inform, new Dart.Snmp.IPEndPoint("myManagerAddress", Manager.DefaultPort));
Console.WriteLine("Received response to inform: " + response.ToString());
Network Management Essentials
Manage network devices and remote information
- Manager component receives and decodes Trap and Inform messages
- Enhanced with .NET 4.5 asynchronous task support for requesting and retrieving management information from Agents
- Superior scaling in high-throughput environments
- Discover agents and query their information base (variables)
- Get an entire table with a single method (supports sparse tables)
- Communicate with agents in parallel (on multiple threads) or serially (on a single thread)
- Send Inform messages to other managers
Respond to SNMP requests and send notifications
- Agent component receives, decodes and responds to Get, GetBulk, Set requests
- Create and send Trap and Inform messages
- Create default responses from requests or build your own
- Automatically updates agent variables and tables
- Start method allow you to specify your delegate that will be asynchronously raised as each SNMP request arrives
- Marshal methods provide easy marshaling of selected objects to the UI thread
- Report statistics on software applications, attached devices, or anything else
Use standard and custom MIBs
- Load and parse MIB files at design-time or run-time
- MibNode definitions use OIDs to associate MIB file definitions with variable IIDs found in PDUs
- Intrinsic support provided for standard SNMPv2 SMI MIBs
- TreeView can be populated with parsed MIBs for easy viewing
- Automatic Tree generation of parsed MIBs for easy viewing
- Design-time Intellisense for standard MIB objects and tables
- Standard and custom MIB file parser
- Full support for SNMPv1, SNMPv2, SNMPv3 and ASN.1 standards
Secure & Interoperable
Comprehensive Security
- Support for DTLS using RSA and DSA certificates
- MD5, SHA authentication support
- DES, Triple DES, AES128, AES192, AES256 encryption support
- Seamless SNMP v3 integration is accomplished using a Security class that is part of every message
- MD5 and SHA1 hashing provides privacy for usernames and passwords
- DES, Triple DES encryption privacy supported (FIPS 140-2 compliant)
- 3 Levels (128, 192, 256) of AES encryption privacy supported (FIPS 140-2 compliant)
- Automatic v3 encryption and decryption
- Automatic sending and handling of discovery messages
- EngineID's are cached, so the use of discovery messages is minimized
- No knowledge of SNMP security formatting required
Interoperability
- Compatible with CISCO, MG-Soft , NET-SNMP and other SNMP software
- Compatible with FIPS 140-2 standards
- Complies with SNMP RFCs for version 1 (1155, 1156, 1157, 1212, 1213, 1215, 2863, 3418), version 2 (1901, 1907, 1908, 3416, 3417), and version 3 (3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3584, 3826, 5343)
Samples & Code Snippets
-
Agent
Demonstrates responding to SNMP requests and sending trap messages. Supports DTLS. -
Manager
Demonstrates getting and setting Agent variables, sending and receiving inform messages, retrieving tables, and receiving traps. Supports DTLS. -
Trap Catcher
Demonstrates receiving and processing trap messages. -
MIB Treeview
Demonstrates displaying mibs in a tree structure and on-demand mib parsing. Also demonstrates mib compilation into code files.
Looking for an SNMP Manager Application?
Included With PowerSNMP for .NET
Features
Manage network devices and remote information
- Manager component receives and decodes Trap and Inform messages
- Enhanced with .NET 4.5 asynchronous task support for requesting and retrieving management information from Agents
- Superior scaling in high-throughput environments
- Discover agents and query their information base (variables)
- Get an entire table with a single method (supports sparse tables)
- Communicate with agents in parallel (on multiple threads) or serially (on a single thread)
- Send Inform messages to other managers
- Manager Component
-Queries SNMP devices on the network by encoding and sending requests
-Receives responses and returns decoded message objects to your code
-Listens for Trap, Notification, and Inform messages and raises your delegate when one is received
-Supports multiple, concurrent queries on multiple worker threads to optimize performance
-Also supports serial queries on a single worker thread to minimize resources expended
-Developer has complete control over timeouts and resends - Automatic, on-the-fly message encoding and decoding
- Discover local agents using network broadcasting
- SNMP Table retrieval is simplified to one line of code that generates multiple requests
- Sends Inform messages to other managers
- Dynamically loads MIB files at runtime
- Message.EncodedMessage property allows logging of encoded message packets
- Start method provides easy synchronous operation on worker threads
- Marshal methods provide easy marshaling of selected objects to the UI thread
- Synchronous methods return a response or table to the calling application
- SNMP v3 security is fully supported:
- MD5, SHA authentication support
-Privacy support uses DES, Triple DES, AES128, AES 192, AES 256
-FIPS 140-2 compliant cryptography
-Automatic v3 discovery, encryption and decryption - Full support for SNMPv1, SNMPv2c, SNMPv3 and ASN.1 standards
- Create trap handling services to automate fault detection
- No knowledge of SNMP message formatting required
- Supports all standard SNMP RFCs, including 1155, 1156, 1157, 1212, 1213, 1215, 1901, 1905, 1906, 1907, 2571, 2572, 2573, 2574, 2575, 2578, 2579, 2580, 3410, 3411, 3412, 3413, 3414, 3416, 3418, 3584, 3826, 5343
Respond to SNMP requests and send notifications
- Agent component receives, decodes and responds to Get, GetBulk, Set requests
- Create and send Trap and Inform messages
- Create default responses from requests or build your own
- Automatically updates agent variables and tables
- Start method allow you to specify your delegate that will be asynchronously raised as each SNMP request arrives
- Marshal methods provide easy marshaling of selected objects to the UI thread
- Report statistics on software applications, attached devices, or anything else
- Agent Component
-Asynchronously receives and synchronously responds to SNMP manager messages
-Constructs and delivers Traps and Informs
-Automatically generates query responses with local values to be sent as-is or modified by your application - Automatic, on-the-fly message encoding and decoding
- Message.EncodedMessage property allows logging of encoded message packets
- SNMP v3 security is fully supported:
-MD5, SHA authentication support
-Privacy support uses DES, Triple DES, AES128, AES 192, AES 256
-FIPS 140-2 compliant cryptography
-Automatic v3 discovery, encryption and decryption - Full support for SNMPv1, SNMPv2, SNMPv3 and ASN.1 standards
- No knowledge of SNMP message formatting required
- Supports all standard SNMP RFCs, including 1155, 1156, 1157, 1212, 1213, 1215, 1901, 1905, 1906, 1907, 2571, 2572, 2573, 2574, 2575, 2578, 2579, 2580, 3410, 3411, 3412, 3413, 3414, 3416, 3418, 3584, 3826, 5343
Use standard and custom MIBs
- Load and parse MIB files at design-time or run-time
- MibNode definitions use OIDs to associate MIB file definitions with variable IIDs found in PDUs
- Intrinsic support provided for standard SNMPv2 SMI MIBs
- TreeView can be populated with parsed MIBs for easy viewing
- Automatic Tree generation of parsed MIBs for easy viewing
- Design-time Intellisense for standard MIB objects and tables
- Standard and custom MIB file parser
- Full support for SNMPv1, SNMPv2, SNMPv3 and ASN.1 standards
- Compile MIB files into code file classes that can be added to C#, VB.NET or C++/CLI projects
-Operates within the designer
-Code files provide design-time Intellisense - Supports all standard SNMP RFCs, including 1155, 1156, 1157, 1212, 1213, 1215, 1901, 1905, 1906, 1907, 2571, 2572, 2573, 2574, 2575, 2578, 2579, 2580, 3411, 3412, 3413, 3414, 3416, 3418, 3584, 3826, 5343
Components
Component | Description |
---|---|
Manager Component | Catches traps and informs, queries SNMP Agents and informs other SNMP Managers. |
Agent Component | Responds to SNMP manager requests, sends traps and informs. |
- Manager and Agent drag and drop components provide UDP transport for SNMP messages
- SnmpSocket class provides high-performance multi-threaded request-response communications
- MibNodes class provides MIB file loading and parsing, as well as MibNode definitions
- Specialized Message classes (GetMessage, GetNextMessage, etc.) provide message encoding, decoding and security
- MIB parser creates dynamic MibNode definition objects from MIB files
- Sample projects for C#, VB.NET, C++/CLI, ASP.NET, PowerShell
- Comprehensive MS Help 2.0 and MS Help Viewer integrated documentation
- Stand-alone and online documentation also included
- Free email support and binary updates during subscription period
Supported Environments
PowerSNMP for .NET supports .NET Framework version 4.5+ or any .NET version implementing .NET Standard 2.0+, as documented here. PowerSNMP for .NET can be used with any .NET compliant language, please see the list below.
Supported languages:
- C#
- VB.NET
- Managed C++
- Powershell
Tested in the following application environments:
- Windows forms desktop applications
- Windows console applications
- Windows ASP.NET web applications and Web Sites
- Windows service applications
- Windows web service applications
- Windows .NET Framework 4 Client Profile
- Windows Presentation Foundation (WPF) applications
Tested in the following development environments:
- Visual Studio .NET (2012, 2013, 2015, 2017, 2019, 2022)
Code Examples
These code snippets for PowerSNMP for .NET can be copied and pasted into your project.
Code Snippet | Description |
---|---|
Get Request | How to send a Get request and receive the response. |
GetBulk Request | How to send a GetBulk request and receive the response. |
Set Request | How to send a Set request and receive the response. |
Send a Trap | How to send a Trap. |
Send an Inform | How to send an Inform and receive the response. |
SNMP Agent | How to initiate an Agent and listen for and respond to SNMP queries (Sets, Gets, etc). |
SNMP Manager | How to initiate a Manager and listen for and respond to SNMP queries (Traps and Informs). |
Sample Projects
Samples are working applications demonstrating SNMP for .NET components in C#, VB.NET, C++/CLI and PowerShell. Source code included. Sample Projects that include .NET Core 2.0 projects, referencing the Dart.Snmp.Standard dll, are marked with the this icon:
Sample Name | Sample Description |
---|---|
Agent | Demonstrates responding to SNMP requests and sending trap messages. Supports DTLS. |
Manager | Demonstrates getting and setting Agent variables, sending and receiving inform messages, retrieving tables, and receiving traps. Supports DTLS. |
Manager Task Async | Uses the Manager Component to build a simple manager. Supports queries for basic variables, either by discovery or specific address. Also shows how to set values. Uses GetResponseTaskAsync to retrieve variable values and send informs. Supports DTLS. |
Device Discovery | Uses the Devices class to demonstrate network device discovery. Supports DTLS. |
Trap Catcher | Demonstrates receiving and processing trap messages. |
MIB Treeview | Demonstrates displaying mibs in a tree structure and on-demand mib parsing. Also demonstrates mib compilation into code files. |
MIB Walker | Demonstrates discovering and retrieving variables supported by an agent under a specified OID. |
SNMP Poll | Demonstrates simultaneous high-performance polling of numerous variables. |
Web Manager (ASP.NET) | Demonstrates getting Agent variable values in a web application. |
Web Service Manager | Demonstrates getting Agent variable values in a web service application. Includes example consumer app. |
WCF Service Manager | Demonstrates getting Agent variable values in a Windows Communication Foundation (WCF) service application. Includes example consumer app. |
WPF Simple Manager | Demonstrates using the Manager component to build a simple manager in WPF |
Agent Console | Demonstrates a simple blocking Agent in a console application. Supports DTLS. |
Trap Console | Demonstrates a simple blocking trap catcher using the Manager component in a console application. |
Manager Console | Demonstrates performing a simple blocking get using the Manager component within a console application. Supports DTLS. |
Agent Service | Uses the Agent Component to build an agent as a windows service. |
Trap Service | Demonstrates a simple trap catcher using the Manager component in a windows service. |
Product Release History for PowerSNMP for .NET
The following is a list of public releases for all components shipped with PowerSNMP for .NET (Latest Release 2023-6-29)
PowerSNMP for .NET
Current Version: 7.0.0.0
7.0.0.0 Released: 2023-6-29
Dart Communications is pleased to announce the release of PowerSNMP for .NET 7.0, to include support for .NET 7.0.
New features and changes in this release:
- Support for SHA-2 authentication algorithms added. (Sha-224, Sha-256, Sha-384, and Sha-512)
6.1.1.2 Released: 2023-2-15
Dart Communications is pleased to announce the release of PowerSNMP for .NET 6.1.
Changes in this release:
- Refactored licensing to autogenerate a 30-day trial license on first use.
- When a runtime license is generated using a trial license it will now contain "Trial" in the name, ex: Dart.Snmp.Trial.lic
6.1.0.0 Released: 2023-1-10
Dart Communications is pleased to announce the release of PowerSNMP for .NET 6.1.
Changes in this release:
- Licensing has been refactored. Please review documentation here.
- Support for .NET Framework 3.5 has been deprecated and a minimum of .NET Framework 4.5 is now required. (Please contact sales@dart.com if you require an assembly for a previous version of .NET Framework.)
- Dart.Snmp.60.dll has been deprecated and removed as use of the .NET standard dll is preferred.
- Improved Visual Studio Integration.
- Full support for .NET 7.
6.0.0.0 Released: 2022-3-23
Dart Communications is pleased to announce the release of PowerSNMP for .NET 6.0 with support for .NET 6.0.
New features and changes in this release:
- Dart.Snmp.60.dll has been added to natively support .NET 6.0.
- Dart.Snmp.50.dll has been deprecated and removed.
5.0.0.3 Released: 2021-4-26
Dart Communications is pleased to announce the release of PowerSNMP for .NET 5.0 with support for .NET 5.0.
New features and changes in this release:
- Dart.Snmp.50.dll has been added to natively support .NET 5.0.
- Dart.Snmp.dll now targets .NET 4.0.
- .NET 3.5 and previous Frameworks are no longer supported, you may request a legacy version via sales@dart.com if support for legacy frameworks is required.
Product fixes in this release:
- An intermittent race condition that could result in DTLS handshake failures has been addressed. (1119)
4.11.1.0 Released: 2020-12-03
- Fixed a minor compatibility issue so that Dart.Snmp.Standard.dll can be used with .NET 5.0.
4.11.0.8 Released: 2020-07-13
- Support for DTLS using RSA and DSA certificates has been added.
- The Devices class has been added which can be used to discover SNMP Agents or Devices and update their status.
- Developer Note: The constructor InformMessage() has been obsoleted but not removed. Users should use InformMessage(long sysUpTime, string oid) going forward.
4.10.3.0 Released: 2019-06-17
Product fixes in this release:
- Fixed an issue that resulted in .NET Standard assemblies being unusable in newer .NET Core preview releases.
- Fixed an issue where GetTable and Walk could return an empty list/array if an error occurs, they will now throw an exception.)
4.10.2.0 Released: 2019-02-05
Product fixes in this release:
- An issue where SNMP variables that are of type octet-string or opaque could not be set to an empty value using an empty string ("" or String.Empty) has been resolved. (1066)
- An issue where using IPEndPoint.Range would not increment the port correctly if binding failed was addressed. (1057)
4.10.1.0 Released: 2019-01-18
- Nuget only release to update product urls.
4.10.0.1 Released: 2018-03-21
- Support for FIPS complaint AES encryption.
- Developer Note: The ReportType.BadPrivacyPassword and ReportType.MissingUserCredentials enumerations have been removed. Exceptions are now thrown in their place.
Product fixes in this release:
- Resolved an issue where a malformed SNMP message could result in a null reference exception being thrown. (1029)
4.9.5.8 Released: 2018-02-22
- Added support for .NET Standard 2.0 and .NET Core 2.0
- New .NET Core 2.0 sample projects, referencing the Dart.Snmp.Standard dll
- Updated trial license operation for use on .NET Standard-compatible platforms
- Details regarding trial operation for Dart.Snmp.Standard.dll can be found in the Licensing and Trial Operation topic in the included help documentation
4.9.4.1 Released: 2017-03-30
Product fixes in this release:
- An issue involving SNMPv3 communications was unintentionally introduced with the release of version 4.9.0.1. With the release of this version, encryption keys were not being cached and therefore regenerated each time they were needed, causing delays. (TFS1005) This has now been addressed. (TFS1005)
4.9.3.0 Released: 2017-03-08
- Visual Studio 2017 compatibility.
4.9.2.0 Released: 2016-10-12
The following variable methods have been added to the VariableCollection collection to provide more convenient access to items within the collection:
- GetByNodeName
- GetByName
- GetByOid
- GetByMibNode - Engine.Clone, TrapUserList.Clone, and User.Clone methods were added.
4.9.1.0 Released: 2016-08-15
- A minor compatibility change was made to allow messages that tag TimeTicks as Integer to be decoded.
Product fixes in this release:
- Displayhint is now correctly inherited from base MIB node definitions. (939)
- linkDown, linkUp, and egpNeighborLoss have been added to the default notification node list. (943)
4.9.0.1 Released: 2016-05-10
- XML serialization support has been added to the SNMP message classes.
- Dual Mode (simultaneous IPv6 and IPv4) sockets are now supported on compatible operating systems. (Vista+)
- Compatibility with third-party SNMP agents and managers has been improved.
Product fixes in this release:
- SNMP message classes will provide correct licensing instructions, when used without a manager or agent component. (676)
- An issue with AES initialization has been addressed. (821)
- A compatibility issue involving CISCO SNMP entities, using AES-192 and AES-256 bit encryption, has been resolved. (825)
4.8.1.0 Released: 2015-04-09
Product fixes in this release:
- The MibNodes.GenerateCode() method no longer throws an erroneous ArgumentException. (663)
4.8.0.3 Released: 2015-03-16
Detailed Release Notes
Product fixes in this release:
- Importing Mibs containing nodes with the same name as default nodes will now work correctly. Nodes with names that match a default node's name will now be renamed with a trailing underscore. (553)
- The Manager component could throw an "IndexOutOfRange" exception if the OIDs attached to a variable were different from the expected. This can occur for agents that incorrectly return 0.0 as the OID for uninitialized variables instead of the appropriate error report. (566)
- An issue where the ErrorIndex property could be incorrectly populated was resolved. (580)
- Unsigned32 is no longer downgraded to SimpleType.UInteger when parsing MIBs, and UInteger32 is now correctly parsed to SimpleType.UInteger. Unsigned32 variables in received messages are now decoded to SimpleType.Gauge as they share an APPLICATION tag value. When creating a Variable for an Unsigned32 type, use Gauge. (583, 588)
- Variable IDs on received requests are no longer assumed to be OIDs. Variable.Definition for received messages now populates with the correct MibNode. (587)
- When using the Variable(MibNode definition) constructor, the Variable.Id generated will now only end in '.0' if Definition.Usage type is Usage.Object. (596)
- Resolved an issue where exceptions could be thrown but not caught with heavy use of asynchronous operations. (597)
- AuthoritativeEngine.Boots is now initialized to 1, and incremented when AuthoritativeEngine.Time reaches Int32.MaxValue. If a different value is desired under other circumstances, it must be set by the application. (605, 606)
4.7.0.1 Released: 2014-07-23
Product fixes in this release:
- Improved parsing of MIB definitions when they are loaded out of order. (261, 307)
- The Agent component no longer throw an ArgumentOutOfRangeException when a .iso variable is used with a GetNextMessage. (317)
- Calling Message.ToString() will no longer throw an exception if the message has not been sent previously. (382)
- An inherited MibNode will use the parent's display hint if the MibNode does not define its own. (384)
- Variables that can be created and are in the Agent's MibNodes collection but not in the Agent's variable collection will now be created if a Set message is received. (412)
- If an agent receives a trap the RequestReceived event will no longer be raised and the Log event will be raised instead. (420)
- Thread safe collections are now used where thread collisions are of concern. (435)
- Removed a call to DoEvents during Mib parsing to allow parsing in environments that do not have access to the System.Windows.Forms namespace. (436)
- Counter, Gauge, TimeTicks and Uinteger will now serialize and deserialize correctly. (437)
- GetBulkMessage will only return variables up to the end of the MibView when repetitions exceed the number of variables available. (512)
- The Agent component's SysUpTime property is no longer part of the component's designer interface. (526)
- Single line enumerated TEXTUAL-CONVENTIONS are now parsed correctly. (527)
- Resolved an issue where the Manager component's Mib importer form would intermittently fail to load. (530)
4.6.1.0 Released: 2014-01-14
Product fixes in this release:
- An intermittent failure with encrypting PDU's using AES was fixed. (380)
4.6.0.1 Released: 2013-11-15
- Dart Communications is pleased to announce the release of PowerSNMP for .NET 4.6.
Some of the new features include:
- Added the ability to send traps from an Agent instance without opening the Agent first.
- Support for sending Informs from Agent to Manager added.
- Log event added to the Agent.
- Better support for script based environments such as PowerShell.
- Message decoding has been relaxed to provide a decoded message whenever possible.
- A Message.Authenticate property has been added to SNMPV3 message classes to indicate whether a message has failed authentication or not.
Some interface changes were necessary to accommodate the new features and performance enhancements. We have made an upgrade guide available to assist in migrating to the new version:
PowerSNMP for .NET 4.6 Upgrade guide
Please contact us with any questions or concerns about migration at support@dart.com.
- Trial operation has changed. In addition to the existing 7-day runtime trial license, a 30-day development trial license will also be enforced.
Product fixes in this release:
- Previously removed Send and Receive methods on ManagerSlave have been restored. Note that the ManagerSlave class has been renamed to SnmpSocket. (TFS198)
- VariableList now supports identifiers equal to the max value of 32 bit unsigned integer. (TFS286)
- Trial notifications have been revamped to be more friendly with service based projects. (TFS294)
- Improved SNMP message handling so that all responses and unsolicited messages received are paired or reported correctly. (TFS314)
4.5.2.1 Released: 2012-10-23
- Trial licensing operation updated.
4.5.1.2 Released: 2012-10-18
- Updated for Visual Studio 2012 integration and Windows 8 compatibility.
Product fixes in this release:
- Addressed an issue where the Load Mib dialog would not display in the designer under Visual Studio 2012 and .NET 4.5. (TFS37)
4.5.0.0 Released: 2012-08-09
Product fixes in this release:
- Added the ToArray method to the SimpleTaggedType class to simplify retrieving a variable's value as a byte array. (5630)
- Added support for decoding message variables when an incorrect variable sequence length is specified. (5639)
- Fixed a mib parsing error that would occur if blank lines are present in a mib file after DESCRIPTION and REFERENCE declarations. (TFS19)
- Fixed a mib parsing error that would occur if a duplicate name was present in the mib file. (TFS25)
- Addressed a globalization issue that prevented correct operation for systems using the following language cultures: Azeri (az), Azeri-Latin (az-Latn), Azeri-Latin-Azerbaijan (az-Latn-AZ), Turkish (tr), Turkish-Turkey (tr-TR) (TFS31)
4.4.4.2 Released: 2012-07-12
Product fixes in this release:
- Fixed a licensing issue with web service applications.
- Updated the title bar of licensing messages to not indicate a product is in trial when it is licensed.
4.4.3.0 Released: 2012-06-27
- Updated trial operation behavior and removed obstacle to using product in .NET Framework 4.5.
- Added a ToArray function to objects that derive from SimpleTaggedType.
- Updated decoding to be more forgiving of messages containing incorrect variable sequence lengths.
4.4.2.3 Released: 2012-04-13
Product fixes in this release:
- It is no longer necessary to add a v3 User to an AgentEngine prior to sending a v3 request to that User.
- Fixed a mib parsing problem - a space is no longer necessary between a syntax type and subtype. (5617)
- Fixed a mib parsing problem - blank lines are now ok after REFERENCE and DESCRIPTION properties. (tfs19)
4.4.1.3 Released: 2012-03-14
- Increased the performance of sending and receiving SNMP v3 requests and responses. (5614)
Product fixes in this release:
- Fixed problem with Display-String when converting bytes to decimal or octal values.
- Fixed mib parsing problem that would occur when an object with a non-unique name was parsed before its ancestors. (5582)
- Fixed problem with the Display-String parsing algorithm. (5591)
- Fixed problem with the built-in "mib-2" branch in the mib tree. (5601)
4.4.0.1 Released: 2011-10-20
- Added new samples for Web Services and Windows Communication Foundation (WCF).
- Added Windows Presentation Foundation versions of the Manager and Agent samples.
- Added a new Walk method for easily walking a branch of an agent's MIB tree.
- Added a VariableList.Populate method for displaying variables in a Treeview control.
- Added SimpleType.ToString overload for displaying variable values using a provided DISPLAY-HINT.
- Added MIB Import support to the Agent component designer.
- Added an IsActive property to the Agent and Manager components.
- Added a retries parameter to the GetTable functions, for agents that do not reply to requests in a timely manner.
Product fixes in this release:
- Variables can now be created with OIDs that contain very large octets (greater than 2^32). (5442)
- The Manager component now gracefully handles v3 agent discovery with an agent that responds to all requests with an invalid Engine ID report containing the wrong Engine ID. (5488)
- The agent no longer responds to v3 requests containing the correct Username but no password(s). (5508)
- The MIB parser now handles Tables and Table Entries whose names do not end in "Table" and "Entry" respectively. (5515)
- Fixed an issue that prevented SNMP for .NET from being used in Debian hosted MONO. (5516)
- The GetTable functions no longer balk on tables with indexers that span multiple octets. (5531)
- MIB definition names with dashes will now result in generated code that is compilable. (5534)
- CreateDefaultResponse now uses the passed in request's Community instead of always using "public." (5539)
4.3.1.0 Released: 2011-02-02
- Replaced the static CreateEndPoint function with an IPEndPoint class derived from System.Net.IPEndPoint.
Product fixes in this release:
- Addressed a memory leak in the agent when receiving requests, and the manager when receiving traps. (5396)
4.3.0.3 Released: 2010-12-13
- The Agent and Manager components have been updated to utilize IO completion threads when listening for traps, notifications, informs and requests.
- Support for IPv6 has been enhanced. A new CreateEndPoint function has been added to the Agent and Manager components. This method provides an easy way to create an IPv4 or IPv6 endpoint from a string host name (or address) and port. Method calls have been streamlined with IPEndPoint parameters.
- "Agent discovery" using Manager.GetResponses now works for SNMPv3. The returned ResponseMessage array will contain ResponseMessages for agents that support the specified user, and ReportMessages for agents that do not.
- Manager.GetResponses will now "broadcast" in IPv6 using the known "FF02::1" multicast group address.
- Agents now include the option of NOT responding to broadcasted requests. Also, agents will now join the known "FF02::1" multicast group if the broadcast option is true and the agent opens on an IPv6 socket.
- Variable.ValueName is now writable. Set this property to an enumerated value and the Variable.Value property will update to the correct integer value.
- A Manager.Log event has been added that is raised whenever an SNMP message is sent or received.
Product fixes in this release:
- Fixed problem with creating Manager event handler functions from the designer. The first handler would appear as expected, but subsequent handlers would not appear until event handlers from any other class were added.
- Replaced derived EventHandler classes and specialized delegates with generic event handlers. The designer will automatically use the new technique when creating and wiring the handler, but changes must be made to existing code. For example:
- OLD: this.manager1.Message += new Dart.Snmp.MessageEventHandler(this.manager1_Message);
- NEW: this.manager1.Message += new EventHandler<MessageEventArgs>(this.manager1_Message);
- Manager.GetResponses will no longer throw any exceptions, as intended. DecodingExceptions will raise the Error event. (5205)
- Message Create method will now accept a mib parameter of null. (5312)
- Fixed manager handling of AuthoritativeEngines. First, the Manager.AuthoritativeEngine now holds its own AuthoritativeEngine (AE). Second, the DiscoveredEngines collection has been replaced with an AgentEngines collection, which is a Dictionary of known Agent AEs, using the agent's IPEndPoint as the key. This allows separate Users collections for each agent. (5324)
- Updated decoding to handle non-spec messages which contain leading byte values of 0. (5345)
- Made many fixes to the included Free Manager application. (5372)
4.2.1.2 Released: 2010-06-04
- SNMP for .NET now supports C++/CLI code generation, in addition to C# and VB.NET.
- PowerSNMP has been updated with a new install and VS 2010 integration.
Product fixes in this release:
- Manager now responds to SNMPv3 Inform messages correctly. (5176)
- Decoding is now forgiving of PDUs with 0-length encoded values. (5184)
- Fixed re-naming issue for duplicate names in different modules. (5198)
- Fixed v3 issue when a GetNext request initiates the discovery process. (5245)
- Agent now sets Authoritative EngineBoots to correct value in response, after receiving a request with an incorrect value. (5297)
4.2.0.0 Released: 2010-01-05
- SNMP for .NET has a new licensing model. External runtime license files are no longer utilized. Instead, a license resource is generated and embedded within the executing assembly.
Product fixes in this release:
- Fixed an issue with v3 security where the agent no longer responds to certain discovery messages with NoSuchObject and UnknownEngineId variables. (5167)
4.1.1.6 Released: 2009-10-30
- An update to licensing and the help file. Note that users with an existing 4.1 Developer License File must obtain a new Developer License File for this release.
- Product fixes in this release:
- Fixed issues with agent and some v3 management software. (5127, 5136)
- Fixed MIB parsing issue when END keyword was part of a description. (5138)
- It is now possible to remove and re-add standard traps to MibNodes.Traps. (5144)
4.1.0.1 Released: 2009-06-25
- A new code generation feature has been added to the product. The MibNodes collection will have a GenerateCode method that will produce a code file that can be added to your C# or VB.NET project. The code file will provide an Import method which will import MibNode and MibTrap objects generated from parsed mib files into an existing MibNodes collection (for example, Manager.Mib). Also, it will create enumerations that will provide Intellisense for the GetByNodeName and GetByTrapName functions during development. See the Mib Treeview sample for a demonstration of code generation, and the Manager and Agent samples for an implementation of the generated code.
- The MibNodes dictionary has been extended with a new Traps property, allowing for Trap referencing in parsed mibs. Traps can be indexed by name or by trap attributes.
4.0.2.0 Released: 2009-06-03
- Added Send and Receive methods to the ManagerSlave object to facilitate communication when the socket should not be blocked while waiting for a response.
- Product fixes in this release:
- Fixed a communication problem with some agents and managers when v3 security was used.
4.0.1.0 Released: 2009-05-15
- Various fixes to the MIB parser.
4.0.0.2 Released: 2009-04-30
- This latest version of the venerable PowerSNMP product line gets a new .NET 2.0 re-design that leverages the power of the latest .NET environments to provide the most advanced Internet Communications components available. Some of the features include:
- SNMP version 1, 2 and 3 with authentication and encryption/decryption
- Built-in objects, identifiers, traps, tables, notifications, and groups as defined in RFCs 1155, 1157, 1158, 1213, 2578, 2579, 3417 and 3418
- MIB parsing, where any custom MIB file can be used to load MIB definitions
- Start method for easily implemented multi-threaded applications, including cross-threading marshaling support
- EncodedMessage property for easy debugging of bytes sent and received, as well as session logging
- FIPS 140-2 compliant cryptography supports government and military requirements
1.2.2.0 Released: 2009-03-03
Product fixes in this release:
- Objects with textual convention syntaxes now support enumerated values, if the textual convention defined them. (4096)
- Fixed a MIB Class generation duplicate-name issue. (4776)
- Variables contained within received messages now have populated Definitions, if the definition was compiled into the component.Mib. (4798)
- The MIB parser is now more forgiving of "::=" tokens which are not surrounded by whitespace. (4981)
1.2.1.0 Released: 2008-06-11
- Version 1.2.0.0 was built without incorporating the fixes to issues 4715 and 4749.
1.2.0.0 Released: 2008-06-06
- The PowerSNMP Free Manager application source code is now included with PowerSNMP for .NET.
- Product fixes in this release:
- The GetTable method overloads will now recognize when there are missing cells and add null variables to preserve the table structure. (4577)
- The Manager will now timeout correctly when requests are made to non-existent agents. (4715)
- MibNodes.TrapMessages now include enterprise specific traps. (4739)
- The GetTable method overloads no longer timeout immediately under high work loads. (4742)
- Fixed v3 so all Auth/Priv/hashing combinations work. (4743)
- Async v3 requests that should timeout now do so. (4749)
1.1.0.4 Released: 2008-04-18
- New MibNodes.Modules table provides information on compiled modules, including defined names and imported definitions.
- New SimpleType.Opaque.ToHexString function converts variable values to hex string representations. Useful for physAddresses, netAddresses, etc.
- Mib compilation now supports objects from different modules with identical names.
Product fixes in this release:
- The SortedVariables collection is now synchronized. (4648, 4691)
- Addressed issues with SNMP v3 discovery. (4706)
1.0.4.3 Released: 2007-11-20
- Added a static GetReponse method to optimize performance in demanding multithreaded applications
- Updated samples with enhanced v3 support
- Exposed 'Clear' and 'Remove' methods of the 'SortedVariables' collection to allow removal of previously added items
- Add 'TrapMessages' collection to 'MibNodes' object to allow examination of compiled trap definitions at runtime
Product fixes in this release:
- Manager can now communicate with Agents using MD5 authentication without privacy (4129)
- Addressed internal exceptions causing problems in applications written using in Framework 2.0 or higher (4293)
- Dynamic classes are no longer created internally. This was causing problems when used in Framework 2.0 or higher (4305)
- Events are now properly raised, and responses are now sent, after receiving v2 and v3 requests for variables not added to Agent.Variables (4362)
- Corrected problem with mib parsing of SYNTAX that would cause Variable.ValueName to be empty (4450)
- Corrected condition that caused a premature timeout exception to occur during secure requests (4500)
- Corrected decoding problem of v3 SHA authentication with privacy (4563)
1.0.3.0 Released: 2006-10-26
Product fixes in this release:
- ErrorStatus.ReadOnly now supersedes ErrorStatus.NotWriteable (4004)
- The Agent SetMessageReceivedEvent now fires when table cells are set (4099)
- Addressed several problems related to GetBulk response messages (4124, 4125)
- SortedVariables collections are now correctly sorted (4138)
1.0.2.0 Released: 2006-08-11
- 64-bit environments now supported
- A new "MibNode.ComposedSyntax" property has been added
- Product fixes in this release:
- Memory leak when Manager was Closed has been addressed (4056)
1.0.1.0 Released: 2006-06-21
Product fixes in this release:
- Corrected a problem where v2 trap messages were not decoded properly (3894)
- Decoding problems now correctly raise a Decoding Exception (3895)
Dart's NEW PowerSNMP Network Manager is a maintained and supported application that includes features not currently offered in the Free Manager. Complete, easy to read documentation is included, along with the features listed below, plus more, scheduled for its next release!
Click the link in the chart below for additional details and to download a Free Trial!
Feature | PowerSNMP Free Manager | PowerSNMP Network Manager |
---|---|---|
Discover SNMP Agents and Network Devices |
||
Query SNMP Agents | ||
Create watches to monitor devices | ||
Send emails on watch failure | ||
Load SNMP MIB files | ||
Improved Network Discovery | - | |
Failure E-mail rate limiting | - | |
Pause and Resume watches | - | |
Manage Loaded MIBs | - | |
Log to CSV | - | |
Support, Updates, and Bug Fixes | - | |
DTLS Support | - | Coming Soon! |
PowerSNMP Free Manager is light-weight SNMP Manager application that demonstrates the capabilities of the following products: PowerSNMP for .NET, PowerTCP Sockets for .NET, and PowerTCP Mail for .NET.
Download PowerSNMP Free Manager
PowerSNMP for .NET Downloads
for .NET Standard 2.0 (supported implementations can be found here) .NET Framework 4.5-4.8
Download Windows Installer (product distribution; includes sample projects)
Download Sample projects (only)
- Add a NuGet Reference to your project.
- Open a command line prompt.
- Install the Dart License tool (.NET 6.0 required): dotnet tool install -g dotnet-dartlicense
- Run the Dart License tool and follow the on screen prompts to activate a trial.
Programming Primer
This primer describes many useful things you need to know about implementing SNMP managers and agents. Written for PowerSNMP for .NET 4.7. Note the definitions available below.
PowerSNMP is organized into 3 sub-systems
- Agent and Manager .NET components derive from SnmpBase for shared functionality. Integrates socket communications with thread management.
- SNMP message classes (GetMessage, GetBulkMessage, GetNextMessage, SetMessage, InformMessage, ReportMessage, Trap1Message, Trap2Message) derive from MessageBase. The Security class implements timeliness, authentication and encryption/decryption user-based security. By exposing properties and lists that correspond to PDU fields, the object model is familiar to knowlegable SNMP programmers and teaches SNMP terminology to the novice.
- MIB classes
- Manager and Agent components can import MIB files at design-time. Source code is added to your project.
- The MibNodes class can import MIB files at run-time to create dynamic MibNode definitions.
- MibNode.Oid property associates a MIB definition with the IIDs found in PDUs.
SNMP Version 3 Supports User-Based Security
- Authentication and privacy password keys are used to hash and encrypt/decrypt PDUs. They are used by agent and manager and are not sent over the wire.
- Security class contains the configuration items needed for encoding.
- AuthoritativeEngine.Users dictionary uses a username key to lookup passwords needed for decoding.
- RequestMessage provides automatic discovery of the remote authoritative engine configuration.
Manager and Agent are the Core Components
-
Manager
- Send a request and receive the response. In code, create a new GetMessage, GetBulkMessage, GetNextMessage, SetMessage or InformMessage and initialize properties. GetResponse() encodes and sends the request, receives the response, decodes it and returns a ResponseMessage. GetResponseTaskAsync() does the same using more scalable, awaitable, asynchronous I/O.
- Receive inform requests (from agents and managers) and traps (from agents).
-
Agent
- Receive requests from managers. A default ResponseMessage can be easily created. Send() encodes and sends the ResponseMessage.
- Send traps to managers. In code, create a new Trap1Message or Trap2Message and initialize properties. Send() encodes and sends the trap.
- Send an inform request to a manager and receive the response. In code, create a new InformMessage and initialize properties. GetResponse() encodes and sends the request, receives the response from the manager, decodes it and returns a ResponseMessage. GetResponseTaskAsync() does the same using more scalable, awaitable, asynchronous I/O.
Thread Management
Worker threads and/or asynchronous communications is necessary to develop robust applications.
-
Manager
- Send a request and receive the response. Start(ThreadStart) starts a worker thread where GetResponse() encodes and sends the request, receives the response, decodes it and returns a ResponseMessage. The Manager can send multiple requests in parallel (one thread per request), in serial (one thread for all requests performed sequentially), or any combination thereof. Alternatively, GetResponseTaskAsync() does the same using more scalable, awaitable, asynchronous I/O.
- Receive inform requests (from agents and managers) and traps (from agents). Start(ManagerMessageReceived) starts receiving packets asynchronously. For inform requests, Send() is used to encode and send a ResponseMessage.
-
Agent
- Receive requests from managers. Start(AgentMessageReceived) starts receiving packets asynchronously. Send() is used to encode and send a ResponseMessage.
- Send traps to managers. Send() can be used on any thread (inluding the UI thread) because encoding and sending a trap is immediate and no response need be received.
- Send an inform request to a manager and receive the response. Start(ThreadStart) starts a worker thread where GetResponse() encodes and sends the request, receives the response, decodes it and returns a ResponseMessage.
Developing a Manager
-
Basic Manager (SNMPv1 or SNMPv2 without security)
- Write a method that will send/receive your request(s). Try using code from the Manager sample application. Multiple requests can be accomplished in parallel or serially.
- Start(ThreadStart) to execute your method on a worker thread. Alternatively, use the awaitable GetResponseTaskAsync() method to make the request without dedicating a thread. -
Advanced Manager adds MIB, trap, inform support
- MIB files can be loaded at design-time or run-time. They are used to build MibNode instances (that provide properties like Name, Description, Oid, Access, Usage, ValueType, etc.) to enhance business logic.
- Write a method that will handle incoming trap and inform messages. Try using code from the Manager sample application.
- Use Start(ManagerMessageReceived) to listen for traps and inform messages. Use Close() to stop listening. -
Secure Manager uses SNMPv3 security
- Set Security properties (username, passwords, etc.) and send requests per step 1 above. The Manager.Security.EngineCache cache optimizes performance.
- To authenticate and decrypt SNMPv3 traps, add username/passwords to Manager.Security.TrapUsers.
- To authenticate and decrypt SNMPv3 inform requests, add username/passwords to Manager.AuthoritativeEngine.Users.
- Received PDUs are decoded using the username in the PDU to lookup the associated passwords in the AuthoritativeEngine.Users dictionary.
Developing an Agent
-
Basic Agent (SNMPv1 or SNMPv2 without security)
- Write a method to handle manager requests. Try using code from the Agent sample application.
- Populate Agent.Variables with MIB values. Use CreateDefaultResponse() to build the ResponseMessage. Use Send(ResponseMessage) to encode and send the response.
- Use Start(AgentMessageReceived...) to listen for requests. Use Close() to stop listening. -
Advanced Agent adds MIB and trap support
- MIB files can be loaded at design-time or run-time. They are used to build MibNode instances (that provide properties like Name, Description, Oid, Access, Usage, ValueType, etc.) to enhance business logic.
- Send traps using Send(Trap1Message) or Send(Trap2Message). -
Secure Agent uses SNMPv3 security
- Set Agent.AuthoritativeEngine.Id to desired EngineId if default is not suitable.
- Add username/passwords to AuthoritativeEngine.Users dictionary.
- Configure authorized SNMP managers with username/passwords.
- Received PDUs will be decoded using the username in the PDU. - Special use can involve sending an inform request to a manager.
- Write a method that will send the inform request. Try using code from the Agent sample.
- Use Start(ThreadStart) to execute your method on a worker thread.
Definitions
Names marked with an asterisk are also PowerSNMP class names. Lowercase is used to indicate generic use (not a class name).
- Agent*. Provides MIB access for all SNMP managers.
- Agent Discovery. Refers to the dynamic discovery of SNMP agents on the network. A manager can broadcast a GetMessage to all computers on the network, but this is becoming less useful as agents that support SNMPv3 decline to respond to broadcast messages. Polling a series of addresses is another alternative, but most manager applications will probably want to persist a list of agents between session.
- AuthoritativeEngine*. Stores EngineID, EngineTime, EngineBoots and username/passwords used for decoding. The authoritative engine is the "owner" of the SNMPv3 security protocol configuration.
- Discovery. Technique used to discover the EngineId, EngineTime and EngineBoots of a remote Authoritative Engine. Transparent to the programmer, negotiating packets can be accessed using the Agent.Log and Manager.Log events.
- GetBulkMessage*. Queries an agent for bulk IID values. ResponseMessage represents the response returned by the Agent.
- GetMessage*. Queries an agent for specified IID values. ResponseMessage represents the response returned by the Agent.
- GetNextMessage*. Queries an agent for IID values that immediately follow the IDs provided. ResponseMessage represents the response returned by the Agent.
- ID. General identifier. OIDs and IIDs are IDs.
- IID. Instance identifier that references the value of an OID instance. "1.3.6.1.6.3.15.1.1.3.0" is an IID. For static OIDs a ".0" is appended to create the IID. For table OIDs a row indexer is appended to create the IID (the row indexer is a unique value for each row in the table).
- InformMessage*. Informs a manager of IID values. ResponseMessage represents the response returned by the Manager.
- Manager*. Manages MIB data via agents. Can receive inform and trap notifications.
- MIB. Management Information Base (data that is read and managed by managers via an agent).
- MIB file. A structured document that defines OIDs. Often parsed by managers to provide contextual information to the user.
- MIB tree. The MIB is often described as a tree graph consisting of OID nodes. An OID with no sub-node is a leaf and has one or more IIDs that reference its data. A static leaf is referenced by appending ".0" to the OID (there is only one value for this kind of leaf). The other kind of leaf is a table row instance, where a table column is designated as the indexer and that value is appended instead of "0".
- OID. Object identifier. An OID as a class definition. "1.3.6.1.6.3.15.1.1.3" is an OID. Each digit, separated by periods, defines a node in the MIB tree.
- Protocol Data Unit (PDU). The encoded bytes that represent an SNMP request, response, inform, report or trap.
- RemoteEngines*. A dictionary of AuthoritativeEngine objects, using an IPEndPoint key, that caches security data and stores username/passwords needed for decoding.
- ReportMessage*. Reports information to a manager (a special kind of ResponseMessage). Used during SNMPv3 discovery.
- RequestMessage*. Base class for GetMessage, SetMessage, GetBulkMessage, GetNextMessage and InformMessage. These messages require a response.
- ResponseMessage*. Class used to return variable values requested.
- SetMessage*. Asks an agent to set IID values. ResponseMessage represents the response returned by the Agent that confirms the values were set.
- Threading. A new worker thread is typically used when a request/response pair are sent/received. Socket.ReceiveFrom() efficiently sleeps until a ResponseMessage is received. This technique protects other application threads from processing delays associated with timeouts, and is recommended.
- Trap1Message*. Notifies a manager of SNMPv1 errors (can include variables). No response required.
- Trap2Message*. Notifies a manager of SNMPv2/3 errors (can include variables). No response required.
- User Based Security. SNMPv3 supports this security model. EngineID and elapsed time are used to ensure timeliness (so packets cannot be replayed later). Optional authenticatin can be specified (a one-way hash ensures the packet has not been tampered with). Optional encryption can be specified (a shared key cypher encrypts the PDU).
- Variable*. An IID/value pair. PDUs contain variables.
Summary
This primer relies on terminology and software constructs that some might consider advanced. Please start by compiling and running our Manager and Agent applications. Look these over and see how multi-threading is used to implement complex operations using very little code.
The following example demonstrates an SNMP variable query in a Windows Forms environment. The query is executed asynchronously, without blocking the UI. The UI is updated with the agent's response.
private void button1_Click(object sender, EventArgs e)
{
//This application has a User-Interface, which we do not want to block.
//Start launches the specified method on a worker thread.
//Event handlers execute on the UI thread.
manager1.Start(sendGetRequest, manager1.Mib.CreateVariable(NodeName.sysContact));
}
private void sendGetRequest(Dart.Snmp.ManagerSlave slave, object state)
{
//This function performs an SNMP Get operation using blocking calls.
//Use the Start method to execute this function on a worker thread.
try
{
GetMessage request = new GetMessage();
request.Community = "public";
request.Version = SnmpVersion.One;
request.Variables.Add(state as Variable);
//Send request and get response
ResponseMessage response = slave.GetResponse(request, myAgentAddress);
//Marshal message to the UI thread using the Message event.
manager1.Marshal(new ResponseMessage[] { response }, "", null);
}
catch (Exception ex)
{
//Marshal exceptions to the UI thread via the Error event.
manager1.Marshal(ex);
}
}
private void manager1_Message(object sender, Dart.Snmp.MessageEventArgs e)
{
//Display info about the first variable in the response, and its value.
//This event fires on the UI thread when a Message is marshaled.
Variable var = e.Messages[0].Variables[0] as Variable;
label1.Text = var.Definition.ToString() + var.Value.ToString();
}
private void manager1_Error(object sender, ErrorEventArgs e)
{
//Update the log with any exceptions that occur.
//This event fires on the UI thread when an Exception is marshaled.
textLog.AppendText("ERROR: " + e.GetException().Message + "\r\n");
}
The following example demonstrates an SNMP agent in a Windows Forms environment. The agent receives requests and responds.
private void button1_Click(object sender, EventArgs e)
{
//This application has a User-Interface, which we do not want to block.
//A callback function is passed to Start, which launches an internal worker thread
//that listens for requests.
//This simple example supports just one variable, which is added to the agent's
//variables collection.
string iid = agent1.Mib.GetByNodeName(NodeName.sysContact).Iid;
agent1.Variables.Add(iid, agent1.Mib.CreateVariable(NodeName.sysContact, "Ned Stark"));
//Start listening for requests.
agent1.Start(agent1_MessageReceived, null);
}
private void agent1_MessageReceived(Agent agent, RequestMessage request, object state)
{
//This callback function executes whenever the agent receives a request.
//A Response message is created and sent to the querying manager.
agent1.Send(agent1.CreateDefaultResponse(request), request.Origin);
}
SNMP Manager Component code example
PowerSNMP for .NET features
PowerSNMP for .NET Manager Component
Use the Snmp Manager component to easily add SNMP management capabilities to your application. Provides an easy-to-use interface that handles the details of querying SNMP Agents that exist on the network. Features include:
- Send SNMP requests and receive responses and traps from SNMP agents. All encoding/decoding is automatic.
- Supports SNMP versions 1, 2 and 3.
- No knowledge of SNMP message formats required.
- Reads MIB files at run time and generates dynamic nodes representing object identifiers.
- Blocking methods return a response or table to the executing thread, and can be used in ASP.NET.
- Start method provides easy to implement worker thread operation.
- Marshal methods marshal data to the UI thread.
- Captures and decodes Traps and Notifications.
- Build messages by setting properties, adding simple variable (OID) objects, and sending. It doesn't get any easier!
- Retrieve tables with a single method call.
- Inform messages are fully supported.
- Supports IPv6
- Discover agents on the network, and broadcast requests
- Log all messages sent and received
- Supports C#, VB.NET, C++/CLI, ASP.NET and other .NET compliant development environments
SNMP Agent Component code example
PowerSNMP for .NET Agent Component
Use the Snmp Agent component to easily build SNMP agents. Provides an easy-to-use interface that handles the details of processing and responding to an SNMP Manager's request. Features include:
- Agent component generates responses to requests and can also initiate trap and notification (v2 trap) messages.
- Supports SNMP versions 1, 2 and 3.
- Requires no other system support besides basic Winsock transport.
- No knowledge of SNMP message formats required.
- Reads MIB files at run time and generates dynamic nodes representing object identifiers
- Handle responses for all requests with an easy CreateDefaultResponse method.
- Automatically switches between v1, v2 and v3 messages.
- Start method provides easy to implement operation on a worker thread.
- Marshal methods handle data marshaling to the UI thread.
- Build messages by setting properties, adding simple variable (OID) objects, and sending. It doesn't get any easier!
- IPv6 support
- Respond to or ignore broadcasted requests
Agent Sample
See all PowerSNMP for .NET Code Examples
The PowerSNMP for .NET Agent sample demonstrates many routine SNMP Agent functions:
- Respond to SNMPv1, SNMPv2, and SNMPv3 queries of standard System Group objects.
- Maintaining SNMPv3 security credentials.
- Dynamically updating objects supported by the sample.
- Sending Trap and Notify messages.
- Dynamically updating an SNMP table which logs set requests.
The PowerSNMP for .NET Agent sample is included with a trial installation of PowerSNMP for .NET. To download a trial please visit the PowerSNMP for .NET product page.
Manager Sample
See all PowerSNMP for .NET Code Examples
- Discovering agents on a network using a broadcast address.
- Getting and setting agent variables.
- Sending SNMPv1, SNMPv2, and secure SNMPv3 queries.
- Sending Inform messages to other managers.
- Receiving and logging Trap, Notify and Inform messages.
- Retrieving and displaying SNMP tables.
- Maintaining SNMPv3 security credentials.
The PowerSNMP for .NET Manager sample is included with a trial installation of PowerSNMP for .NET. To download a trial please visit the PowerSNMP for .NET product page.
Trap Catcher Sample
See all PowerSNMP for .NET Code Examples
The PowerSNMP for .NET Trap Catcher sample demonstrates handling incoming traps sent by SNMP Agents and includes the following features:
- Receive and process SNMPv1 Trap, SNMPv2 Notify messages, and SNMPv3 secure Notifications/
- Maintaining SNMPv3 credentials for known Agents.
- Logs SNMP activity to the User Interface or disk.
- Displays important trap information.
The Trap Catcher sample is included with the full trial installation of PowerSNMP for .NET. To download a trial please visit the PowerSNMP for .NET product page.
MIB Treeview Sample
See all PowerSNMP for .NET Code Examples
The PowerSNMP MIB Treeview sample demonstrates how to use PowerSNMP for .NET's MibNode class and MibNodes collection class to do the following:
- Parse standard and custom MIB files.
- Present the MIB hierarchy in treeview control.
- Add new MIB files to the existing hierarchy.
- Report and log parsing errors.
- Display definition information for objects in the tree.
The PowerSNMP for .NET MIB Treeview sample is included with the full trial installation of PowerSNMP for .NET. To download a trial please visit the PowerSNMP for .NET product page.
MIB Walker Sample
See all PowerSNMP for .NET Code Examples
- Walk an agent's MIB starting from the specified OID.
- Present retrieved variables in a treeview.
- Dynamically load MIB files to provide definitions for retrieved variables.
- Report and log error.
- Display name and definition information for retrieved variables.
The MIB Walker sample is included with the full trial installation of PowerSNMP for .NET. To download a trial please visit the PowerSNMP for .NET product page.
Poll Sample
See all PowerSNMP for .NET Code Examples
The Poll Sample demonstrates how to implement Agent polling with the PowerSNMP for .NET Manager component and contains the following features:
- Simultaneously and independently poll numerous SNMP variables..
- Poll multiple agents with high performance.
- Configuring variabales to be polled at time based intervals.
- Discover available agents on the network using a broadcast address.
- Present variables from dynamically loaded MIB files.
- Track poll results in a table.
The SNMP Polling Sample sample is included with the full trial installation of PowerSNMP for .NET. To download a trial please visit the PowerSNMP for .NET product page.
Web Manager (ASP.NET) Sample
See all PowerSNMP for .NET Code Examples
The PowerSNMP for .NET ASP.NET SNMP Manager Sample demonstrates how to use the manager component within ASP.NET and has the following functions:
- Retrieves all variables in an agent's system group.
- Supports SNMPv1, SNMPv2, and SNMPv3.
- Displays any reported retrieval errors.
With the PowerSNMP Manager component, applications can accomplish all these tasks.
The ASP.NET SNMP Manager sample is included with the full trial installation of PowerSNMP for .NET. To download a trial please visit the PowerSNMP for .NET product page.
See all PowerSNMP for .NET Code Examples
Get Request Example
This example demonstrates sending a Get request and receiving the response.
//Create Manager, and Socket to send request from
Manager manager1 = new Manager();
SnmpSocket managerSocket = new SnmpSocket(manager1);
//Create Get Request
GetMessage request = new GetMessage();
request.Variables.Add(manager1.Mib.CreateVariable(NodeName.sysContact));
//Or by IID: request.Variables.Add(manager1.Mib.CreateVariable(new Variable("1.3.6.1.2.1.1.4.0"));
//Optionally use version 3. Set username and passwords.
request.Version = SnmpVersion.Three;
request.Security.User.Name = "testAuthPriv";
request.Security.User.AuthenticationProtocol = AuthenticationProtocol.Md5;
request.Security.User.AuthenticationPassword = "dartauth";
request.Security.User.PrivacyProtocol = PrivacyProtocol.Des;
request.Security.User.PrivacyPassword = "dartpriv";
//Send request and get response
ResponseMessage response = managerSocket.GetResponse(request, new Dart.Snmp.IPEndPoint("myAgentAddress", Agent.DefaultPort));
//Display the value
Console.WriteLine(response.Variables[0].ToString());
To download a trial please visit the PowerSNMP for .NET product page.
See all PowerSNMP for .NET Code Examples
Set Request Example
This example demonstrates sending a Set request and receiving the response.
//Create Manager, and Socket to send request from
Manager manager1 = new Manager();
SnmpSocket managerSocket = new SnmpSocket(manager1);
//Create Set Request
SetMessage request = new SetMessage();
request.Variables.Add(manager1.Mib.CreateVariable(NodeName.sysContact), "Systems Admin");
//Optionally use version 3. Set username and passwords.
request.Version = SnmpVersion.Three;
request.Security.User.Name = "testAuthPriv";
request.Security.User.AuthenticationProtocol = AuthenticationProtocol.Md5;
request.Security.User.AuthenticationPassword = "dartauth";
request.Security.User.PrivacyProtocol = PrivacyProtocol.Des;
request.Security.User.PrivacyPassword = "dartpriv";
//Send request and get response
ResponseMessage response = managerSocket.GetResponse(request, new Dart.Snmp.IPEndPoint("myAgentAddress", Agent.DefaultPort));
//Confirmation that the value was updated by the agent:
Console.WriteLine(response.Variables[0].ToString());
To download a trial please visit the PowerSNMP for .NET product page.
See all PowerSNMP for .NET Code Examples
Send Inform Example
This example demonstrates sending an Inform and receiving the response.
//Create Agent, and Socket to send Inform from
Agent agent1 = new Agent();
SnmpSocket agentSocket = new SnmpSocket(agent1);
//Create an inform message, the 2nd value should be changed to the relevant OID
InformMessage inform = new InformMessage(agent1.SysUpTime, "1.3.6.1.4.42.3.1");
ResponseMessage response = agentSocket.GetResponse(inform, new Dart.Snmp.IPEndPoint("myManagerAddress", Manager.DefaultPort));
Console.WriteLine("Received response to inform: " + response.ToString());
To download a trial please visit the PowerSNMP for .NET product page.
See all PowerSNMP for .NET Code Examples
Send Trap Example
This example demonstrates sending traps.
//Create Agent, and Socket to send Trap from
Agent agent1 = new Agent();
//Set sysObjectId to your enterprise number (for Trap1).
agent1.Variables.Add(agent1.Mib.GetByNodeName(NodeName.sysObjectID).GetIid(), agent1.Mib.CreateVariable(NodeName.sysObjectID, "1.3.6.1.4.1.52222"));
//Send an SNMPv1 Trap
agent1.Send(new Dart.Snmp.Trap1.warmStart(agent1.Variables[agent1.Mib.GetByNodeName(NodeName.sysObjectID).GetIid()].Value.ToString(), agent1.SysUpTime), new Dart.Snmp.IPEndPoint("myManagerAddress", Manager.DefaultPort));
//Send an SNMPv2 Trap (for SNMPv3, configure warmStart.Security.User)
agent1.Send(new Dart.Snmp.Trap2.warmStart(agent1.SysUpTime), new Dart.Snmp.IPEndPoint("myManagerAddress", Manager.DefaultPort));
To download a trial please visit the PowerSNMP for .NET product page.
See all PowerSNMP for .NET Code Examples
SNMP Agent Example
This example demonstrates initiating an Agent and listening for and responding to SNMP queries (Sets, Gets, etc).
private void Form_Load(object sender, EventArgs e)
{
Agent agent1 = new Agent();
//Add a variable to the agent
agent1.Variables.Add(agent1.Mib.GetByNodeName(NodeName.sysContact).GetIid(), agent1.Mib.CreateVariable(NodeName.sysContact, "Systems Admin"));
//Start listening for requests
agent1.Start(agent1_MessageReceived, null);
}
private void agent1_MessageReceived(Agent agent, RequestMessage request, object state)
{
//Create and send a response whenever a request is received
agent.Send(agent.CreateResponse(request), request.Origin);
}
To download a trial please visit the PowerSNMP for .NET product page.
See all PowerSNMP for .NET Code Examples
SNMP Manager Example
This example demonstrates initiating a Manager and listening for and responding to SNMP queries (Traps and Informs).
private void Form_Load(object sender, EventArgs e)
{
Manager manager1 = new Manager();
//Start listening
manager1.Start(manager1_NotificationReceived, null);
}
private void manager1_NotificationReceived(Manager manager, MessageBase message, object state)
{
//Handle informs
if (message is InformMessage)
{
//Send response to inform message origin
manager.Send(new ResponseMessage(message as InformMessage, null), message.Origin);
}
//Display Trap or Inform content
Console.WriteLine(message.ToString());
}
To download a trial please visit the PowerSNMP for .NET product page.
See all PowerSNMP for .NET Code Examples
GetBulk Example
This example demonstrates sending a GetBulk request and receiving the response.
//Create Manager, and Socket to send request from
Manager manager1 = new Manager();
SnmpSocket managerSocket = new SnmpSocket(manager1);
//Create GetBulk request
GetBulkMessage request = new GetBulkMessage();
//Request the 6 objects after 'system'
//This means creating a GetBulk message with a single variable and Repetitions set to 6.
request.Variables.Add(manager1.Mib.CreateVariable(NodeName.system));
request.Repetitions = 6;
ResponseMessage response = managerSocket.GetResponse(request, new Dart.Snmp.IPEndPoint("myAgentAddress", Agent.DefaultPort));
//Display response
Console.WriteLine(response.ToString());
To download a trial please visit the PowerSNMP for .NET product page.
Purchase Options
Customize your product and support options match your needs. Discounts are applied when products are purchased in multiples or within available product suites.
Have any questions about purchasing? See our Sales FAQ