Implementing an SNMP Reporter (agent) in C# (must run on Mono)?
Asked Answered
T

2

5

I am attempting to implement some additional statistics gathering in a C# server application - I have about 20 or so variables I'd like to be able to report to network monitoring tools; so I am assuming (hopefully correctly) that SNMP is the correct way to go.

There are however two problems:

  • The application is an open source server that cant include proprietary components, and
  • It needs to run on Mono under *nix environs as well as Windows via .NET.

The "#SNMP" library at https://sharpsnmp.com/ appears to be a promising solution - but there are no samples I can find; and my knowledge of SNMP is lacking.

Does anyone here have any (quick) examples of reporting data via SNMP? (ideally using a library under the LGPL, X/MIT, BSD or Zlib licenses)

Help much appreciated

Edit: The problem appears to be a lack of libraries capable of acting as SNMP servers, if anyone is aware of any - this would probably solve the problem nicely.

Edit #2: Basically I'm looking for a SNMP server library or sample reference implementation.

Toadflax answered 1/11, 2009 at 7:13 Comment(1)
Do you want to implement an SNMP agent or SNMP manager? (Agent is running on device which is monitored, sends snmp traps to SNMP manager and provides information to manager when polled.)Progressionist
L
6

As the author :) I suggest you check out TestAgent sample. It can send out TRAP or INFORM messages to the IP address you specify.

Note that this is a tiny sample, which does not reveal all powers of SNMP.

Lipocaic answered 5/11, 2009 at 7:4 Comment(3)
Just to keep you updated, I am happy to announce now this TestAgent (snmpd) is capable of SNMP v1 operations on a few basic objects. This will be released in either 3.5 or 4.0 release.Lipocaic
It is now a good time to update here. Since Change Set 39585, sharpsnmplib.codeplex.com/SourceControl/list/changesets, #SNMP Agent (snmpd) fully supports Mono 2.6.3 on openSUSE. That should guarantee it runs fine on other Linux distributions via Mono.Lipocaic
Just keep readers update. #SNMP 6 enhanced this SNMP agent further so that it is better compliant to SNMP RFC documents. sharpsnmplib.codeplex.com/releases/view/46604 Ubuntu is officially supported besides openSUSE.Lipocaic
P
2

#SNMP source comes with some samples (they're actually tests, but one can have an idea about how it works). Another thing you could try is send your snmp queries calling directly the snmpget executable with the Process class. It's not the best way, but it could work (I've used this kind of approach with another language).

Painstaking answered 1/11, 2009 at 14:44 Comment(1)
other way around - I'm looking to implement a 'server' rather than a client. There's plenty of examples for client/requests but nothing I can find for serving.Toadflax

© 2022 - 2024 — McMap. All rights reserved.