Hi Dave,

Thank you very much for you help. You suggestion is very good, but it's 
different from our design......

Here's the expected behavior and some example code of our program:

1. Parse configuration files and generate several SNMP tables according to the 
configuration. After that, create a standard snmp mib(SNMP v2 protocol) file 
contain all the generated SNMP tables. 
2. Register the snmp handler and call back functions for each SNMP tables on 
snmp subagent. 

 1) Register the call back function to deal with the snmp get request within 
the netsnmp_create_handler_registration() , which will register the net snmp 
handler for snmp get/get next functionality

       xReg = netsnmp_create_handler_registration( 
              xTableName,     GeneratedTable_handler, 
              xSnmpTableOid,  xSnmpTableOidLen, 
              HANDLER_CAN_RONLY 
              ); 

 2)Register the net snmp table iterator to loop for the content of all the 
index for a snmp table, especially for the get-next request:

   netsnmp_iterator_info           *iinfo; 
   netsnmp_table_registration_info *table_info; 
   iinfo->get_first_data_point = GeneratedTable_get_first_data_point; 
   iinfo->get_next_data_point  = GeneratedTable_get_next_data_point; 
   iinfo->table_reginfo        = table_info; 
    
   netsnmp_register_table_iterator( reg, iinfo ); 

3) implement the table iterator to loop the content of mib table
  netsnmp_variable_list*
  NETSNMPHandler::GenericTable_get_first_data_point(void **my_loop_context,
                                                       void **my_data_context,
                                                       netsnmp_variable_list 
*put_index_data,
                                                       netsnmp_iterator_info 
*mydata)
  {
    *my_loop_context =  _GenericTable_head;
               
    return GenericTable_get_next_data_point(my_loop_context, my_data_context,
                                                put_index_data,  mydata );
  }

  netsnmp_variable_list*
  NETSNMPHandler::GenericTable_get_next_data_point(void **my_loop_context, void 
**my_data_context,netsnmp_variable_list *put_index_data,netsnmp_iterator_info 
*mydata)
  {   
   struct genericTable_entry * entry  = (struct 
genericTable_entry*)*my_loop_context; 
   netsnmp_variable_list *idx = put_index_data;     
   if ( entry ) {
      snmp_set_var_value( idx, (u_char *)&(entry->appIndex), 
sizeof(entry->appIndex) );
      ......                  
      return put_index_data;
   } else {
      return NULL;
   }
  }
   

4) write the snmp table handler to deal with specific kind of 
request(get/get-next)

3. Use 3rd party snmp tools to send snmp get/get-next request for particular 
mib entries of the generated snmp table.
What I need to implement is using the Agent API to rigister all the generated 
SNMP tables on the snmp subagent.But it seems that the snmp gent could only 
recognize the index of the generated snmp table. 
The generated mib file is very simple, just a snmp table with serval attirbutes.

The expected result is the customer was able to config the snmp table and then 
they will be able to use the generated mib file without asking us to write the 
specific code for the new mib.Do you think it's realizable?

I hope you could understand my issue from the information above. Thank you very 
much:)

Best Regards,
Chen Fei

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf 
Of Dave Shield
Sent: 2011年1月6日 17:02
To: Chen Figo
Cc: [email protected]; Bachmann Marcel; Mele Giovanni; 
Derouault Jacky
Subject: Re: Request help about how to use the dynamic tables

2011/1/6 Chen Figo <[email protected]>:
> Because we have multiple customer, and they want have different mib 
> definition,

"Different MIB definitions" implies you are talking about different management 
information, so you would presumably need different code to retrieve that 
underlying data anyway.
   Jumping through hoops to try and cram all of this into a single MIB 
framework seems unnecessarily complicated.

Why not define a single MIb framework (for internal use) that handles the 
overall requirements, and then ship tailored sub-sets to the individual 
customers?
(I presume they typically don't care what numeric OIDs they see, just as long 
as the information is there in the format they expect.

I'm still struggling to visualise exactly what you are trying to achieve here.
Perhaps if you could post an example of a couple of these MIBs (suitably 
sanitised if need be), so that we could understand this a bit better.



> . If we use the common mode, we need to create specific code for each of them.

If you're not using specific code, then how do you intend to retrieve the 
underlying data needed for each of the customers' requirements?
Surely different data will need to be retrieved using specific code?



> Do you know if I can use some Agent API from the web page 
> http://www.net-snmp.org/docs/man/ to implement such kind of feature?

What you are describing is running contrary to the design framework of SNMP, so 
there won't be anything we provide that is intended to
support it.   If you insist on working in a non-standard way, then you
are going to end up on your own.

Dave

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to