Custom SNMP Trap implementation in .NET.

I need to create a monitoring mechanism using SNMP (in .NET). I think we will use the nsoftware component to handle most of the work.

It looks like we should use "traps" to communicate from agent to server. We will have several different traps and various information describing each trap. What is the best way to implement custom traps? That is, the best way to not only send a trap, but also send information describing the trap to our "snmp manager"? I think this is done through "variable bindings". To use "variable bindings", do we need to create our own "enterprise number" and use the "enterpriseSpecific" trap? Should we implement our own custom MIBs or can we just send the necessary data using a trap (via variable bindings)?

+3
source share
2 answers

If you do not want to notify one of 5 predefined traps (for example, cold start, warm start): yes, you need to define an enterpriseSpecific trap, and you will need to highlight object identifiers (and there are many of them).

Parameters are passed in variable bindings; these are structures defined as

VarBind ::=
         SEQUENCE {
           name ObjectName,
           value ObjectSyntax
         }

VarBindList ::= SEQUENCE OF VarBind

ObjectName ::= OBJECT IDENTIFIER
ObjectSyntax ::= CHOICE {
     simple SimpleSyntax,
     application-wide ApplicationSyntax
}

SimpleSyntax ::= CHOICE {
     number INTEGER,
     string OCTET STRING,
     object OBJECT IDENTIFIER,
     empty  NULL
}

ApplicationSyntax ::=  CHOICE {
      address  NetworkAddress,
      counter  Counter,
      gauge    Gauge,
      ticks    TimeTicks,
      arbitrary  Opaque
}

You somehow need to tell your library what the name and meaning are; the library must provide an API to support the various types of data available as values. Note that the variable names are again the identifiers of the object.

+4
source

I suggest you first determine how many cases your agent will send data back to the server / monitor.

, ( ).

MIB.

, . , "nsoftware one - ".

, TRAP v2 INFORM TRAP v1.

,

http://sharpsnmplib.codeplex.com

+1

Source: https://habr.com/ru/post/1719138/


All Articles