Hi Dave,

Please allow me to explain from where I  believe my CPU consumption is 
occuring.
I believe that I have used functions header_generic and header_simple_table 
in an errornous manner.
I am not able to find the difference between the variable *name passed in 
the function parameter of my FindVarMethod and the variable vp->name also 
available. Where is the oid in the snmp request? is it in vp->name or in 
*name?
In addition, I have an octet-string as index for my tables, I know that I 
can't use the function header_simple_table but I don't know what function 
should I use or the algorithm needed to write such a function.
I have noticed a weird behavior in the snmp requests which i believe is 
coming from the fact that I am failing to see the difference between the 
variables, below is an example of this behavior:

command used:
snmpwalk -v 2c -c public localhost test

my FindVarMethod:
u_char *var_simple(struct variable *vp, oid *name, size_t *length, int 
exact, size_t *var_len,
                  WriteMethod **write_method)
{
  static int val;
  char OIDReq[MAX_SIZE];

  printf("Handling a simple request");
  if (header_generic(vp,name,length,exact,var_len,write_method)== 
MATCH_FAILED )
  {
     return NULL;
 }

  snprint_objid(OIDReq,MAX_SIZE, name,*length);
  printf("Requested OID: %s",OIDReq);

//OIDReq contains the oid requested search for it and return value if found 
or return null if not found ....,
  }

Below is log:

Handling a simple request
Handling a simple request
Requested OID: enterprises.jinny.generic.test.license.0
enterprises.jinny.generic.test.license found returning 1000
Handling a simple request
Handling a simple request
Requested OID: enterprises.jinny.generic.test.active-sub.0
test.active-sub not found returning 0
Handling a simple request
Handling a simple request
Requested OID: enterprises.jinny.generic.test.active-sub.0
test.active-sub not found returning 0
Handling a simple request
Handling a simple request
Requested OID: enterprises.jinny.generic.test.profact-total.0
enterprises.jinny.generic.test.profact-total found returning 1
Handling a simple request
Handling a simple request
Requested OID: enterprises.jinny.generic.test.profact-total.0
enterprises.jinny.generic.test.profact-total found returning 1
Handling a simple request
Handling a simple request
Requested OID: enterprises.jinny.generic.test.profact-err.0
enterprises.jinny.generic.test.profact-err found returning 1
Handling a simple request
Handling a simple request
Requested OID: enterprises.jinny.generic.test.profact-err.0
enterprises.jinny.generic.test.profact-err found returning 1
//and it continues like this, every request is sent two times

Could you please inform me if the behavior is correct? Why is the request 
one time for test.license and two times for every other counter?
I have other problems also when it comes to table but i think these problems 
are related

I appreciate your help

Reagrds,
Marwan


----- Original Message ----- 
From: "Dave Shield" <[email protected]>
To: "Marwan Khoury" <[email protected]>
Cc: <[email protected]>
Sent: Saturday, August 22, 2009 8:46 PM
Subject: Re: CPU consumption


> 2009/8/19 Marwan Khoury <[email protected]>:
>> How can I add caching to the table?
>
> There is a cache helper designed specifically for this purpose.
> You can 'inject' this helper into the handler chain, before your
> MIB table handler, and it will invoke routines (which you should
> provide) to load and release the cache appropriately.
>
> This is used in a number of the existing MIB modules, which can
> be used as an example of the technique.  See the current agent code for 
> details.
>
> Dave


--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.64/2318 - Release Date: 08/21/09 
18:06:00


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to