lextudio / sharpsnmplib

Sharp SNMP Library- Open Source SNMP for .NET
https://sharpsnmp.com
MIT License
356 stars 152 forks source link

SNMP agent updating object status in MIB file #635

Closed lextudio-support closed 3 hours ago

lextudio-support commented 3 hours ago

Hello everyone,

I am developing an SNMP agent that can monitor my custom application. What I have done is I have created my custom object structure in a new MIB file. I am not able to find out how my custom MIB will be loaded for SNMP messages? and how can my agent app write the status of objects in MIB file? Can any one please guide me how to use sharpsnp library to achieve this.

Thanks & Kind Regards

Original Reported Date: 2011-01-12T00:05:09.55-08:00 Original CodePlex Discussion Thread ID: 241398

lextudio-support commented 3 hours ago

Copied from CodePlex without authors:

also it would be great help from you if you could provide me the sample code to use sharpsnmp library achieving this task ?

Original Posted Date: 2011-01-12T00:42:24.06-08:00

lextudio-support commented 3 hours ago

Copied from CodePlex without authors:

Hi,

You still need to better learn about SNMP concepts. The MIB file is simply a written contract between the agent and the manager. "how can my agent app write the status of objects in MIB file" is not a valid statement.

First, you need to determine what objects are needed in the agent to provide all kinds of information the manager expects. Then you may put down the objects into a MIB file (or not if you don't need to share that information with others) and determine how to assign OIDs to the objects.

Second, when you move on to implement the objects in our snmpd sample, you can derive new classes from ISnmpObject or abstract classes such as SnmpObject, or ScalarObject (implementing the interface allows snmpd to load your objects). Currently snmpd only implements simplest objects, but you can easily create complex objects on your own.

Finally, you can use an SNMP manager to test out the new objects you implemented in snmpd.

I don't have plan to provide more things in the snmpd sample, as it is not intended to be used for production purposes even at this moment.

Regards,

Lex

Original Posted Date: 2011-01-12T01:47:38.793-08:00

lextudio-support commented 3 hours ago

Copied from CodePlex without authors:

Hello,

Thank you for the reply. if the status of objects are not stored in MIB file then what happens if the manager querys for any object? I assumed MIB is a database where the objects availble for monitoring are stored and the agents updates the status related information in the MIB which can later be queried by the snmp manager.

In my case I have a document management software working on a server. I need to have a monitoring agent on that server to check if its up and working fine or not. Hence I want to allow my snmp manager to query about the status of my document management software. Also i need to send traps oto the manager if any operation has failed. So I have defined these operations in my MIB file but what would the manager get on querying for any object?

Also can you please share documentation of sharpsnmp library?

Thanks & Regards,

Munir

Original Posted Date: 2011-01-12T02:40:49.603-08:00

lextudio-support commented 3 hours ago

Copied from CodePlex without authors:

Hi Munir,

:) MIB documents are not database. Though SNMP objects are stored on the agent side, how to store them are implementation dependent. You can choose any way you like.

Please take a look at snmpd sample, and see how it supports operations on basic SNMP objects. Then you can try to implement some objects to test out the infrastructure.

If you download the binary package for each releases, you can see the help files inside. There is no help files for source code packages.

Regards,

Lex

Original Posted Date: 2011-01-12T04:21:53.75-08:00

lextudio-support commented 3 hours ago

Copied from CodePlex without authors:

thanks lex, can you please provide me the link for snmpd sample source code? Also whenever a query is initiated from manager, do we have agent always listening to those queries? and is this responsibility of the agents to respond manager's query? do we need to have agents activley listening and waiting for manager's query?

I just need to see the end to end cycle of snmp message request/delivery, it would be a great help if you could provide me the said sample.

Reagrds,

Munir

Original Posted Date: 2011-01-12T05:07:58.907-08:00

lextudio-support commented 3 hours ago

Copied from CodePlex without authors:

Hi,

If you use our 6.0 release, then you should see an snmpd folder at the top level in the code base,

http://sharpsnmplib.codeplex.com/SourceControl/changeset/view/5497af31d15e#

The objects currently supported by snmpd are here,

http://sharpsnmplib.codeplex.com/SourceControl/changeset/view/5497af31d15e#SharpSnmpLib%2fObjects%2fSysContact.cs

A few notes:

1. The SNMP agent must always monitor the incoming port 161 for requests. Otherwise, how can it get those requests?

2. How to respond to the manager is defined by SNMP RFC documents. In most cases, a response message should be sent, but there are still cases no response is sent. You need to read those RFCs to better understand how to handle messages. The sample does not yet conform to all RFCs as it is simply a sample.

3. Once you are familiar with snmpd, you should be able to see how I design processing pipeline on agent side. I know "it would be a great help if you could provide me the said sample." but I don't have too much time to help on every question.

Regards,

Lex

Original Posted Date: 2011-01-12T18:50:08.87-08:00

lextudio-support commented 3 hours ago

Marked as Answer Date: 2013-10-06T04:50:30.543-07:00