2009/2/6 Rodolfo Leffa <rodolfole...@gmail.com>:
>> > I'd like to deal with all requests to a subtree of my mib in a single
>> > handler, but i don't know how to do it.
>>
>> Registering the root using 'netsnmp_register_handler()' does exactly
>> this.   But it does mean that you have to deal with *everything* under
>> the specified root yourself.  That can get quite complex.
>
> I think I will take my chances! I'm already dealing with the request to get
> the information I want from the devices managed, so i'll put some extra code
> to recognize when a request is not part of my MIB.

Simply recognising when a request isn't part of your MIB is relatively
straightforward. That's not where the problems tend to arise.

GET requests are simple - it's handling GETNEXT that takes more work.
You've got to take an (arbitrary) OID that falls within your MIB, and decide
which is the next valid instance.




>> What is the structure of the MIB you are trying to implement?
>
> The MIB is all consisted of Integers and Strings and enums. Like This:
>
> k3lDeviceCount OBJECT-TYPE
>             SYNTAX      Integer32
>             MAX-ACCESS        read-only
>             STATUS        current
>             DESCRIPTION    "Numero de placas ativas no sistema."
>         ::= { KhompDataDeviceCount}

Errr... that doesn't look valid.
I'd normally expect to see something like

   k3lDeviceCount ....   ::== { khompDataDeviceCount 1 }

(and similarly for k3lDeviceType)


>     linkCount OBJECT-TYPE
>             SYNTAX          Integer32
>             MAX-ACCESS      read-only
>             STATUS          current
>             DESCRIPTION      "Numero de links."
>         ::= { KhompDataDeviceConfig 1 }
>
>     channelCount OBJECT-TYPE
>             SYNTAX          Integer32
>             MAX-ACCESS      read-only
>                STATUS          current
>             DESCRIPTION      "Numero de canais."
>         ::= { KhompDataDeviceConfig 2 }

Those look better - except that the parent name ought to start
with a lower-case letter.
   You probably ought to run your MIB through some form of
MIB validation (e.g. http://www.simpleweb.org/ietf/mibs/validate/)
The Net-SNMP MIB parsing code is relatively forgiving, and will
accept invalid input.


> The MIB is all consisted of Integers and Strings and enums.

If they are all single values (rather than tables), then I'd
suggest you use "netsnmp_register_scalar()" to register
the objects individually, or "netsnmp_register_scalar_group()"
to register them in clumps.

Dave

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to