Thanks Dave.
I will try the cache method you mentioned to see how it works for me.
fill_table() function simply reads and parses /proc/net/dev file and fills
table with statistics for the wireless interfaces (wifi0,wifi1......). So one
attempt to this function fills the whole table.
BR,
Reza
________________________________
From: Dave Shield <d.t.shi...@liverpool.ac.uk>
To: Reza Salehi <rezsal...@yahoo.com>
Cc: SNMP FORUM <net-snmp-users@lists.sourceforge.net>
Sent: Friday, January 4, 2013 1:41 PM
Subject: Re: Question regarding Tables in net-snmp
On 4 January 2013 18:21, Reza Salehi <rezsal...@yahoo.com> wrote:
> I put a printf("test"); inside the former one (
> athStatusTable_get_first_data_point() ).It gets called once if I run
> snmpget but still it gets called multiple time ( up to number of column in
> the table) if I run snmpwalk or snmptable.
Yes, that's correct.
This is the way that the iterator helper works.
You haven't shown how 'fill_table' works, but I suspect this
helper is probably not the best choice for your requirements.
> Maybe I need to run mib2c diffrently? or I am missing something here.
>
> .... The only problem is I need to put my function which fills the
> table somewhere to gets called once in response to snmptable or snmpwalk
What I would suggest is that you run
mib2c -S cache=1 -c mib2c.table_data,conf athStatusTable
This will include code to load the contents of the table into a local
cache, which will then be used to process requests. That 'load_table'
routine is essentially the same as your curent 'fill_table', and will be
called whenever the cache is regarded as "too old" to be used.
If you tweak the cache timeout to a suitable value, this will typically
be re-loaded at the start of a walk, and remain valid for the duration.
You could use the same cache approach with the iterator helper
as well, but the table_data helper is probably more efficient.
Dave
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
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