Quantcast
Channel: C# Based Open Source SNMP Library for .NET and Mono
Viewing all 576 articles
Browse latest View live

Commented Unassigned: Recompile old version: namespaces not found ?? [7279]

$
0
0
Hello !

I am coming from version 4 .... and recompile a Tableviewer. Not a problem to use Messenger.GetTable instead of Manager, but wether "Variable", "SnmpException" nor "ObjectIdentifier" are recognized: "are you missing a reference ..".
I just have downloaded the latest 8.5... via NuGet, but the docs (chm) on Codeplex looks async to it ?? !! I dont have Visual Studio.

Any help would be great!

Thanks anyway and
best regards,

Manfred

Comments: Visual Studio Community Edition is free (2013 is recommended), so you might use that. Without more info, I can only assume the NuGet package was not properly restored, so that no reference can be found.

Updated Wiki: SNMP v3 Operations

$
0
0
SNMP v1 and v2c were designed to be simple, but one significant issue of them is security. It is very hard to hide community strings from sniffers, and also difficult to set access control on entities.

IETF recognized SNMP v3 RFC documents in 2004, which uses a new design to address the security concerns. The changes were so huge, so #SNMP has to expose a different styles of APIs for developers to perform v3 operations.

Below a few SNMP v3 operations (GET, SET and so on) are translated to #SNMP function calls,

Discovery Process

SNMP v3 defines a discovery process in RFC 3414, that before an SNMP agent responds to a manager the two must interchange information such as time stamp, engine ID and so on.

Discovery discovery = Messenger.GetNextDiscovery(SnmpType.GetRequestPdu);
ReportMessage report = discovery.GetResponse(60000, new IPEndPoint(IPAddress.Parse("192.168.1.2"), 161));

Above we perform such a discovery process by sending out a GetRequestPdu type of discovery message, and the agent replies with a ReportMessage which we can reuse later to construct a valid request.

User Credentials

SNMP v3 requires user credentials to be passed on in each requests, so we need to prepare that information ahead of time.

var auth = new SHA1AuthenticationProvider(new OctetString("myauthenticationpassword"));
var priv = new DESPrivacyProvider(new OctetString("myprivacypassword"), auth);

Assume the agent requires both authentication (SHA-1) and privacy (DES) protection, then above we create a single provider that embeds both passwords.

GET Operation

The following code shows how to send an SNMP v3 GET message to an agent located 192.168.1.2 and query on OID 1.3.6.1.2.1.1.1.0,

GetRequestMessage request = new GetRequestMessage(VersionCode.V3, Messenger.NextMessageId, Messenger.NextRequestId, new OctetString("myname"), new List<variable>{new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.1.0"))}, priv, Messenger.MaxMessageSize, report);
ISnmpMessage reply = request.GetResponse(60000, new IPEndPoint(IPAddress.Parse("192.168.1.2"), 161));
if (reply.Pdu().ErrorStatus.ToInt32() != 0) // != ErrorCode.NoError
{
    throw ErrorException.Create(
        "error in response",
        IPAddress.Parse("192.168.1.2"),
        reply);
}

The reply object usually contains the response message we expect. By accessing reply.Pdu().Variables we can see what data are returned.

SET Operation

The following code shows how to send an SNMP v3 SET message to an SNMP agent located at 192.168.1.2 and set the value of OID 1.3.6.1.2.1.1.6.0 to "Shanghai",

SetRequestMessage request = new GetRequestMessage(VersionCode.V3, Messenger.NextMessageId, Messenger.NextRequestId, new OctetString("myname"), new List<variable>{new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.1.0"), new OctetString("Shanghai"))}, priv, Messenger.MaxMessageSize, report);
ISnmpMessage reply = request.GetResponse(60000, new IPEndPoint(IPAddress.Parse("192.168.1.2"), 161));
if (reply.Pdu().ErrorStatus.ToInt32() != 0) // != ErrorCode.NoError
{
    throw ErrorException.Create(
        "error in response",
        IPAddress.Parse("192.168.1.2"),
        reply);
}

GET-BULK Operation

The following code shows how to send an SNMP v3 GET-BULK message to an SNMP agent located at 192.168.1.2 and query on OID 1.3.6.1.2.1.1.1.0,

GetBulkRequestMessage request = new GetBulkRequestMessage(VersionCode.V3, Messenger.NextMessageId, Messenger.NextRequestId, new OctetString("myname"), 0, 10, new List<variable>{new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.1.0"))}, priv, Messenger.MaxMessageSize, report);
ISnmpMessage reply = request.GetResponse(60000, new IPEndPoint(IPAddress.Parse("192.168.1.2"), 161));
if (reply.Pdu().ErrorStatus.ToInt32() != 0) // != ErrorCode.NoError
{
    throw ErrorException.Create(
        "error in response",
        IPAddress.Parse("192.168.1.2"),
        reply);
}

var result = reply.Pdu().Variables;

WALK Operation

The following code shows how to perform v3 WALK on an SNMP agent located at 192.168.1.2 starting at 1.3.6.1.2.1.1,

var result = new List<variable>();
Messenger.BulkWalk(VersionCode.V3, 
                   new IPEndPoint(IPAddress.Parse("192.168.1.2"), 161), 
                   new OctetString("public"), 
                   new ObjectIdentifier("1.3.6.1.2.1.1"), 
                   result, 
                   60000, 
                   10, 
                   WalkMode.WithinSubtree, 
                   priv, 
                   report);

TRAP v2 Operation

Note that TRAP v1 message format is obsolete by TRAP v2. Thus, for SNMP v3 TRAP operations, you can only use TRAP v2 message format.

The following code shows how to send a TRAP v2 message to an SNMP manager/trap listener located at 192.168.1.2,

var trap = new TrapV2Message(
                VersionCode.V3,
                528732060,
                1905687779,
                new OctetString("neither"),
                new ObjectIdentifier("1.3.6"),
                0,
                new List<Variable>(),
                DefaultPrivacyProvider.DefaultPair,
                0x10000,
                new OctetString(ByteTool.Convert("80001F8880E9630000D61FF449")),
                0,
                0
               );
trap.Send(new IPEndPoint(IPAddress.Parse("192.168.1.2"), 162));

INFORM Operation

Comparing to sending TRAP v2 messages, it is common to send INFORM messages.

The following code shows how to send an INFORM message to an SNMP manager/trap listener located at 192.168.1.2,

Messenger.SendInform(
                    0,
                    VersionCode.V3,
                    new IPEndPoint(IPAddress.Parse("192.168.1.2"), 162),
                    new OctetString("neither"),
                    new ObjectIdentifier(new uint[] { 1, 3, 6 }),
                    0,
                    new List<Variable>(),
                    2000,
                    DefaultPrivacyProvider.DefaultPair,
                    report);


To help you understand how to use the API provided by #SNMP Library, there are more sample projects you can find under Samples folder in source code package. Both C# and VB.NET samples are available.

The help documentation is available online at http://help.sharpsnmp.com.

Updated Wiki: 600005

$
0
0

KB 600005 How to compile source code on Windows

Summary

This article describes how to compile #SNMP source code on Windows.

Prerequisites

You may download the source code from https://github.com/lextm/sharpsnmplib/releases.

Default Configuration

#SNMP has several projects.

For release 8.0 and below, most of them are configured to compile against .NET Framework 3.5 except SharpSnmpLib.csproj who is against .NET Framework 2.0.

If you have .NET Framework 3.5 installed

.NET Framework 3.5 SP1 is available here.
  1. Install .NET SDK or Visual Studio.
  2. Execute prepare.bat to prepare necessary files.
  3. Execute release.35.bat to build the source code.
The compiled binaries are in the bin folder. They are built using MSBuild 3.5. Core assemblies are against .NET 2.0 SP2, while others against .NET 3.5 SP1.

For release 8.5, the projects are configured to compile against .NET 4.0.

If you have .NET Framework 4.0 installed

.NET Framework 4.0 installer is available here.
  1. Install .NET SDK or Visual Studio.
  2. Execute prepare.bat to prepare necessary files.
  3. Execute release.bat to build the source code.
The compiled binaries are in the bin folder. They are built using MSBuild 4.0.

.NET 4

Visual Studio 2013 Community Edition is the recommended IDE to view and edit the code base.

More Information

#SNMP is supported on Windows Vista (SP2), Windows 7 (SP1), Windows Server 2008 (SP2), Windows Server 2008 R2, Windows 8, Windows Server 2012, Windows 8.1, Windows Server 2012 R2 and Windows 10.

Windows XP and Windows Server 2003 support have expired due to Microsoft product lifecycle.

References

N/A

Created Unassigned: MIB Compiler Illegal Syntax TEXTUAL-CONVENTION [7280]

$
0
0
I am trying to use the MIB compiler to compile publicly available APPC-MIB module, and the following definition seems to be raising the exception "illegal syntax for textual convention. Wrong entity, DisplayString in file ...".


SnaSenseData ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"To facilitate their display by a Management Station, sense
data objects in the MIB are represented as DisplayStrings of
size 8. Eight '0' characters indicates that no sense data
identifying an SNA error condition is available."

SYNTAX DisplayString (SIZE (8))



I have been able to open this MIB file with ManageEngine's MIB Browser tool, so I'm thinking that lexer hasn't properly dealt with valid syntax.

Created Unassigned: Unable to receive SNMPv3 traps [7281]

$
0
0
Hello,

I'm trying to implement SNMPv3 trap functionality for agent and management station. In this case it's just the adapted sample snmpd and snmptrapd applications while evaluating.

The whole process gets aborted while the incoming trap message is being processed at SnmpSecureContext.cs:192 where the check for presence of the Reportable flag in the received trap message fails:
```
if ((user.ToSecurityLevel() | Levels.Reportable) != request.Header.SecurityLevel)
{
HandleFailure(Group.UnsupportedSecurityLevel);
return false;
}
```

And Wireshark tells me this via the telegram info:
```
report SNMP-USER-BASED-SM-MIB::usmStatsUnsupportedSecLevels.0
```

According to RFC 3412 section 6.4 the Reportable flag must never be set for SNMPv2 trap PDUs. Can you please give some hints on how to implement SNMPv3 trap reception correctly using #SNMP?

By the way, the library's assembly version is 8.9.010914.01.

Thanks a lot,
Kristian Virkus

Edited Unassigned: Unable to receive SNMPv3 traps [7281]

$
0
0
Hello,

I'm trying to implement SNMPv3 trap functionality for agent and management station. In this case it's just the adapted sample snmpd and snmptrapd applications while evaluating.

The whole process gets aborted while the incoming trap message is being processed at SecureSnmpContext.cs:192 where the check for presence of the Reportable flag in the received trap message fails:
```
if ((user.ToSecurityLevel() | Levels.Reportable) != request.Header.SecurityLevel)
{
HandleFailure(Group.UnsupportedSecurityLevel);
return false;
}
```

And Wireshark tells me this via the telegram info:
```
report SNMP-USER-BASED-SM-MIB::usmStatsUnsupportedSecLevels.0
```

According to RFC 3412 section 6.4 the Reportable flag must never be set for SNMPv2 trap PDUs. Can you please give some hints on how to implement SNMPv3 trap reception correctly using #SNMP?

By the way, the library's assembly version is 8.9.010914.01.

Thanks a lot,
Kristian Virkus

Updated Wiki: Documentation

$
0
0

Updated Wiki: CompilerProReview

$
0
0
The Trial Edition can be requested here, and is packaged up with #SNMP Library 8.5 and the latest SharpSnmpPro.Mib.

To test it out, the default test MIB documents can be found at GitHub. It can be cloned to a local folder, such as D:\sharpsnmppro-mib.
git clone https://github.com/lextm/sharpsnmppro-mib.git

Then the documents can be copied to that folder (D:\sharpsnmppro-mib for example).

Launch the compiler by executing Compiler.exe and then click File | Open menu item to navigate to D:\sharpsnmppro-mib folder in Open file dialog.

Change the file extension filter to All files (.), and then select all .txt files in this folder. Click Open button to open all files in the compiler. The file names should appear in Solution Explorer panel.

Click Build | Compile menu item to start compiling the files. In a few seconds, the Object Tree panel should be updated with objects extracted from the files, while Module List panel shows the loaded modules (as well as pending ones). The Error List panel should display any error or warnings. The Output panel contains the diagnostics logging entries.

Commented Unassigned: MIB Compiler Illegal Syntax TEXTUAL-CONVENTION [7280]

$
0
0
I am trying to use the MIB compiler to compile publicly available APPC-MIB module, and the following definition seems to be raising the exception "illegal syntax for textual convention. Wrong entity, DisplayString in file ...".


SnaSenseData ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"To facilitate their display by a Management Station, sense
data objects in the MIB are represented as DisplayStrings of
size 8. Eight '0' characters indicates that no sense data
identifying an SNA error condition is available."

SYNTAX DisplayString (SIZE (8))



I have been able to open this MIB file with ManageEngine's MIB Browser tool, so I'm thinking that lexer hasn't properly dealt with valid syntax.

Comments: You need to grad basic documents following this guide, https://sharpsnmplib.codeplex.com/wikipage?title=CompilerProReview and use the attached two documents for testing.

Closed Unassigned: MIB Compiler Illegal Syntax TEXTUAL-CONVENTION [7280]

$
0
0
I am trying to use the MIB compiler to compile publicly available APPC-MIB module, and the following definition seems to be raising the exception "illegal syntax for textual convention. Wrong entity, DisplayString in file ...".


SnaSenseData ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"To facilitate their display by a Management Station, sense
data objects in the MIB are represented as DisplayStrings of
size 8. Eight '0' characters indicates that no sense data
identifying an SNA error condition is available."

SYNTAX DisplayString (SIZE (8))



I have been able to open this MIB file with ManageEngine's MIB Browser tool, so I'm thinking that lexer hasn't properly dealt with valid syntax.

Comments: The user must use proper MIB documents instead of anything downloaded from the Internet.

Closed Unassigned: Recompile old version: namespaces not found ?? [7279]

$
0
0
Hello !

I am coming from version 4 .... and recompile a Tableviewer. Not a problem to use Messenger.GetTable instead of Manager, but wether "Variable", "SnmpException" nor "ObjectIdentifier" are recognized: "are you missing a reference ..".
I just have downloaded the latest 8.5... via NuGet, but the docs (chm) on Codeplex looks async to it ?? !! I dont have Visual Studio.

Any help would be great!

Thanks anyway and
best regards,

Manfred

Commented Unassigned: Unable to receive SNMPv3 traps [7281]

$
0
0
Hello,

I'm trying to implement SNMPv3 trap functionality for agent and management station. In this case it's just the adapted sample snmpd and snmptrapd applications while evaluating.

The whole process gets aborted while the incoming trap message is being processed at SecureSnmpContext.cs:192 where the check for presence of the Reportable flag in the received trap message fails:
```
if ((user.ToSecurityLevel() | Levels.Reportable) != request.Header.SecurityLevel)
{
HandleFailure(Group.UnsupportedSecurityLevel);
return false;
}
```

And Wireshark tells me this via the telegram info:
```
report SNMP-USER-BASED-SM-MIB::usmStatsUnsupportedSecLevels.0
```

According to RFC 3412 section 6.4 the Reportable flag must never be set for SNMPv2 trap PDUs. Can you please give some hints on how to implement SNMPv3 trap reception correctly using #SNMP?

By the way, the library's assembly version is 8.9.010914.01.

Thanks a lot,
Kristian Virkus
Comments: https://github.com/lextm/sharpsnmplib/commit/c55d7a46eec74bf78182b8085af7f6e6317374e0 Fixed here.

Closed Unassigned: Unable to receive SNMPv3 traps [7281]

$
0
0
Hello,

I'm trying to implement SNMPv3 trap functionality for agent and management station. In this case it's just the adapted sample snmpd and snmptrapd applications while evaluating.

The whole process gets aborted while the incoming trap message is being processed at SecureSnmpContext.cs:192 where the check for presence of the Reportable flag in the received trap message fails:
```
if ((user.ToSecurityLevel() | Levels.Reportable) != request.Header.SecurityLevel)
{
HandleFailure(Group.UnsupportedSecurityLevel);
return false;
}
```

And Wireshark tells me this via the telegram info:
```
report SNMP-USER-BASED-SM-MIB::usmStatsUnsupportedSecLevels.0
```

According to RFC 3412 section 6.4 the Reportable flag must never be set for SNMPv2 trap PDUs. Can you please give some hints on how to implement SNMPv3 trap reception correctly using #SNMP?

By the way, the library's assembly version is 8.9.010914.01.

Thanks a lot,
Kristian Virkus

Created Unassigned: "truncation error for 32-bit integer coding" exception when trying to connect to a snmpv3-enabled device [7282]

$
0
0
Hello,
Sometimes when trying to connect to a snmpv3-enabled device using the following code:

```
var discovery = Messenger.GetNextDiscovery(SnmpType.GetRequestPdu);
var report = discovery.GetResponse(6000, endpoint);
```
I receive the following exception:
"truncation error for 32-bit integer coding"

The weird thing is that it does not always happen.

Thanks in advance.

Edited Unassigned: "truncation error for 32-bit integer coding" exception when trying to connect to a snmpv3-enabled device [7282]

$
0
0
Hello,
Sometimes when trying to connect to a snmpv3-enabled device using the following code:

```
var discovery = Messenger.GetNextDiscovery(SnmpType.GetRequestPdu);
var report = discovery.GetResponse(6000, endpoint);
```
I receive the following exception:
"truncation error for 32-bit integer coding"
Stack trace:

```
at Lextm.SharpSnmpLib.Integer32..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Stream stream)
at Lextm.SharpSnmpLib.ReportPdu..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Stream stream)
at Lextm.SharpSnmpLib.Sequence..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Stream stream)
at Lextm.SharpSnmpLib.Sequence..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.Messaging.MessageFactory.ParseMessage(Int32 first, Stream stream, UserRegistry registry)
at Lextm.SharpSnmpLib.Messaging.MessageFactory.ParseMessages(Byte[] buffer, Int32 index, Int32 length, UserRegistry registry)
at Lextm.SharpSnmpLib.Messaging.SnmpMessageExtension.GetResponse(ISnmpMessage request, Int32 timeout, IPEndPoint receiver, UserRegistry registry, Socket udpSocket)
at Lextm.SharpSnmpLib.Messaging.Discovery.GetResponse(Int32 timeout,
...
```

The weird thing is that it does not always happen.

Thanks in advance.

Closed Issue: Wrong Response Sequence [7268]

$
0
0
I am getting an error when running Get requests on a device and need to know what the error indicates. If I do a Walk using a MIB browser after I get this issue I can get all the data. It is only #SNMP that has an issue.

Details:

I am calling Messenger.Get using SNMP V1 and I am querying 24 SNMP objects.

Exception:
{"wrong response sequence: expected -1986527, received 14790689"}

StackTrace:
at Lextm.SharpSnmpLib.Messaging.SnmpMessageExtension.GetResponse(ISnmpMessage request, Int32 timeout, IPEndPoint receiver, UserRegistry registry, Socket udpSocket) in c:\sharpsnmplib\SharpSnmpLib\Messaging\SnmpMessageExtension.cs:line 440
at Lextm.SharpSnmpLib.Messaging.SnmpMessageExtension.GetResponse(ISnmpMessage request, Int32 timeout, IPEndPoint receiver, Socket udpSocket) in c:\sharpsnmplib\SharpSnmpLib\Messaging\SnmpMessageExtension.cs:line 355
at Lextm.SharpSnmpLib.Messaging.SnmpMessageExtension.GetResponse(ISnmpMessage request, Int32 timeout, IPEndPoint receiver) in c:\sharpsnmplib\SharpSnmpLib\Messaging\SnmpMessageExtension.cs:line 320
at Lextm.SharpSnmpLib.Messaging.Messenger.Get(VersionCode version, IPEndPoint endpoint, OctetString community, IList`1 variables, Int32 timeout) in c:\sharpsnmplib\SharpSnmpLib\Messaging\Messenger.cs:line 96
at Comms.Snmp.SharpSNMPDevice.ProcessSnmpGets() in z:\Projects\SES Astra\2400 Program\Software\Source\SESAstraServer\SESAstraServer\Comms\Snmp\SharpSNMPDevice.cs:line 892

Please advise.

Closed Unassigned: wrong response sequence exception [7266]

$
0
0
Hi,
I'm getting wrong response sequence error, i will call getreponse method in a loop using threads,
since requestid is static it is throwing above exception,
could you please tell me how to resolve this

Commented Issue: WSACancelBlockingCall on receiving Inform messages [4685]

$
0
0
Often get this exception on receiving multiple inform messages:

A blocking operation was interrupted by a call to WSACancelBlockingCall
System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
System.Net.Sockets.Socket.SendTo(Byte[] buffer, EndPoint remoteEP)
Lextm.SharpSnmpLib.Messaging.GetResponseMessage.Send(EndPoint receiver, Socket socket) at SharpSnmpLib\Messaging\GetResponseMessage.cs:line 121
Lextm.SharpSnmpLib.Messaging.InformRequestMessage.SendResponse(IPEndPoint receiver) at SharpSnmpLib\Messaging\InformRequestMessage.cs:line 107
Lextm.SharpSnmpLib.Messaging.DefaultListenerAdapter.Process(ISnmpMessage message, IPEndPoint sender) at SharpSnmpLib\Messaging\DefaultListenerAdapter.cs:line 97
Lextm.SharpSnmpLib.Messaging.Listener.HandleMessage(MessageParams param) at SharpSnmpLib\Messaging\Listener.cs:line 408
Lextm.SharpSnmpLib.Messaging.Listener.HandleMessage(Object o) at SharpSnmpLib\Messaging\Listener.cs:line 398
System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
Comments: This issue is very likely to be caused by stopping the listener binding when it is still sending the INFORM message. The old patch switched to async which hides the issue, but a proper fix (now at GitHub) should handle the exception properly.

Updated Wiki: FAQ

$
0
0
How can I learn more about SNMP and MIB?
Answer: For beginners you might start from good books such as Essential SNMP and Understanding SNMP MIBs.

For advanced, you might check out the original RFC documents from IETF and review existing SNMP implementation such as Net-SNMP.

Where can I find more samples?
Answer: The source code package contains more samples, which are under Samples folder. Both C# and VB.NET samples are available.

Why are there only C#/VB.NET samples?
Answer: You can easily convert C# sample code to other .NET languages using this SharpDevelop web site. The conversion result may not be perfect, but it shows how to make API calls.

ILSpy is another tool that can help translate the code. Simply open our C# version samples (exe or dll) and check the disassembled code.

The good news is that VB.NET samples are added in 5.0 release.

Is there a class reference?
Answer: Help packages (both CHM and Help2 versions) are available in binary release packages. You can also build them from source code.

What if my question is not answered in the KB articles?
Answer: You can check the StackOverflow, as project team already answered a lot of questions there. If your question is not listed there, please post it and wait for replies.

Is this library free for commercial projects?
Answer: It is really hard to start an open source project because you need to find a proper license. In my case, I want this library to be both strict open source and friendly to commercial world. Therefore, at last I use MIT/X11 to cover the code. This means if you follow MIT/X11 rules, you can use this library in commercial projects for free. Note that portion of the code base is covered by BSD 3 Clause.

Does it support SNMP v3?
Answer: SNMP v3 support is complete. #SNMP supports all RFC required authentication (MD5, SHA-1) and privacy (DES, AES) algorithms.

Does it support all SNMP devices?
Answer: Probably not. SNMP has been an ancient protocol, but not all vendor products (both hardware and software) strictly follow the rules. #SNMP is only capable of supporting most of them which are standard compliant.

Non standard devices can lead to various issues, and below are the ones reported back by users,

It is not a complete list but should shed some light on how to troubleshoot and locate the culprit. You will have to modify #SNMP to adapt to those problems on your own.

What's the current version and previous versions?
Answer: Please refer to our Roadmap here.

Why should I use this library?
Answer: It is hard to explain.
On one hand, there are indeed a lot of commercial packages available throughout the market. However, my evaluation shows that most of them are too expensive and a few of them only provides limited functions a developer may need.
On the other hand, there are few open source packages existing on .NET platform. For example, I cannot compile SNMP++.NET successfully and I don't think that library provides a natural enough API interface.

Could I contribute to this project?
Answer: Welcome. You can do a lot to help even if you may not have the chance and ability to contribute patches and new functions.
Here are a list of items I expect,
  • Comments on the API, such as "this part of API is not natural enough. We need to change it to blah blah blah and then it is more natural".
  • Bug reports, such as "it does not work in my case. What's up then"?
  • Patches, such as "I found a bug and created a patch to fix it, so please merge it into the repository". I am more than glad to hear from you.
  • New functions, such as "why not implement something like this".
You can always start your own fork from here

Why choosing CodePlex as homepage and GitHub as source code host?
Answer: Well, I think combination of the two matches all needs of this project.

Why when I compile the source code weird errors happen?
Answer: You will need to use Git to check out the source code. I don't support ZIP packages downloaded from CodePlex.

Which language does this library support?
Answer: Technically speaking, all .NET languages are supported, such as C#, VB.NET, Oxygene, C++/CLI, IronPython, IronRuby, and so on.

Is this library thread safe?
Answer: Not yet. Please use static methods in Messenger class which should be thread safe.

How to diagnose problems?
Answer: Please follow KB 600008.

Why are some methods marked as Obsolete?
Answer: #SNMP Library API changes across major releases. Therefore, there are some methods marked as obsolete somewhere. Please avoid using them as they are to be removed in future releases.

How to fire feature requests?
Answer: You can add new feature requests and vote on features using the Issue Tracker.

If all above do not resolve your problem or you have questions on them, please feel free to start a discussion in StackOverflow.

Commented Unassigned: "truncation error for 32-bit integer coding" exception when trying to connect to a snmpv3-enabled device [7282]

$
0
0
Hello,
Sometimes when trying to connect to a snmpv3-enabled device using the following code:

```
var discovery = Messenger.GetNextDiscovery(SnmpType.GetRequestPdu);
var report = discovery.GetResponse(6000, endpoint);
```
I receive the following exception:
"truncation error for 32-bit integer coding"
Stack trace:

```
at Lextm.SharpSnmpLib.Integer32..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Stream stream)
at Lextm.SharpSnmpLib.ReportPdu..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Stream stream)
at Lextm.SharpSnmpLib.Sequence..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Stream stream)
at Lextm.SharpSnmpLib.Sequence..ctor(Tuple`2 length, Stream stream)
at Lextm.SharpSnmpLib.DataFactory.CreateSnmpData(Int32 type, Stream stream)
at Lextm.SharpSnmpLib.Messaging.MessageFactory.ParseMessage(Int32 first, Stream stream, UserRegistry registry)
at Lextm.SharpSnmpLib.Messaging.MessageFactory.ParseMessages(Byte[] buffer, Int32 index, Int32 length, UserRegistry registry)
at Lextm.SharpSnmpLib.Messaging.SnmpMessageExtension.GetResponse(ISnmpMessage request, Int32 timeout, IPEndPoint receiver, UserRegistry registry, Socket udpSocket)
at Lextm.SharpSnmpLib.Messaging.Discovery.GetResponse(Int32 timeout,
...
```

The weird thing is that it does not always happen.

Thanks in advance.
Comments: https://sharpsnmplib.codeplex.com/wikipage?title=FAQ Just added a new section "Does it support all SNMP devices?" for your reference. It is very likely that you hit an encoding issue on Integer type. You will have to capture network packets to confirm. #SNMP is not designed to support non standard devices, but you are free to modify its source code.
Viewing all 576 articles
Browse latest View live


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