Thanks for your quick help, Wes!
    As to the MIB, it's clear.
    Referring the 2nd question, I would like to ask if there are any
examples of recovering "dynamic" variables.
    So far, I'm basing my sub-agent in the net-snmp sub-agent example, but
in its mib there is just a simple Integer number. I would need some way to
retrieve a value calling, for example, a function, that is, get some kind of
handler to be called when I get a GET request... Is there something like
that in the net-snmp API? Or is there any other way to do this?
    Thank you so much for your help!


On Wed, Dec 10, 2008 at 2:37 PM, Wes Hardaker <
[EMAIL PROTECTED]> wrote:

> >>>>> On Wed, 10 Dec 2008 12:53:15 +0000, "Raúl Mellado" <
> [EMAIL PROTECTED]> said:
>
> RM> x.1 //struct_b
> RM> x.1.1 // 1st struct_a
> RM> x.1.1.1 // 1st field of 1struct_a
> RM> x.1.1.2 // 2nd field of 1struct_a
> RM> x.1.2 // 2nd struct_a
> RM> x.1.2.1 // 1st field of 2struct_a
> RM> x.1.2.2 // 2nd field of 2struct_a
>
> RM> and so on... ¿Is it possible to define something like that on a MIB
> file?
>
> Not quite, but otherwise yes...  You need each "field" of you structure
> to be a different column.  IE, the first field would be x and the second
> field would always be in (new) "y".  But after that you can encode depth
> by defining the index as either an OID or a string which has variable
> length and depth associated with it.  There is a caveat that the maximum
> length of an oid (including indexes and the oid up to the column number)
> must be <= 128 in size.
>
> RM> On the other hand, I fill all my stored status structures in a data
> RM> collector thread, every 10 seconds (i get the data from a socket); then
> when
> RM> I get a SNMP GET request I need to get the last stored value (for each
> var)
> RM> and reply with it to the SNMP request; what could be the ideal way to
> do
> RM> this? ¿Should I store my values in rows in different tables (using
> net-snmp
> RM> table API) and update the values every time I get new data?
> RM> Thank you so much for your help and time; I don't know what I could do
> RM> without net-snmp and your support
>
> If you're collecting it anyway, it's easiest to just store the data in
> whatever form you need it in and have requests sent for the table just
> go look for the data as it's needed.
>
> If you simply want to handle caching and the data doesn't need to be
> collected for other reasons within your application (IE, the 10 second
> collection is only for SNMP purposes) you should look into cache timers
> which will allow you to trigger data collection on the first request
> and use the cached results for the rest of the incoming requests for the
> next X seconds (defaults to 30).
> --
> Wes Hardaker
> Sparta, Inc.
>
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to