Rob,

I am talking about counters which change dynamically over time and there are 
pretty dynamic. Also new virtual servers get added and deleted on the fly. So 
the creation of these virtual servers will result in a new row entry.

mani

-----Original Message-----
From: Mani Pooni [mailto:ma...@a10networks.com] 
Sent: Thursday, July 09, 2015 5:05 PM
To: net-snmp-coders@lists.sourceforge.net
Subject: RE: table handler code when the index is a ASN_OCTET_STR

Rob,

Thanks for your reply. I was able to register a table oid and table_info 
structure using netsnmp_register_table(reginfo, table_info). When a request 
comes in, the handler gets invoked and by looking at the root oid I am able to 
create a table_data_set if it does not exist with dynamic rows. I looked at 
netsnmp_table_data_helper_handler and mimicked that behavior for get and 
get-next except for the fact I call the dataset to fetch the first row or the 
requested row. Now all the calls including get bulk and get subtree are all 
working. What I think I need to do is throw it into a cache with some 
configurable expiry time and then when a new request comes in check if it is in 
cache otherwise create the table. So I have a couple of questions here ..

1) since I created the table data set is there some way I can associate it with 
the requests and get the handler to do all the work. I don't want to add the 
code for get and get-next in my code. Also if there are several indexes I need 
to handle everyone of those cases. Can I inject another handler and do the 
processing after creating the table ? 
2) Is there any example code to look at to create a cache handler ?

Thanks to everyone for responding to my questions. You have been really helpful.

mani


-----Original Message-----
From: NetSNMP Mailbox [mailto:net-snmp-m...@freesnmp.com] On Behalf Of Robert 
Story
Sent: Thursday, July 09, 2015 4:44 PM
To: Mani Pooni
Cc: net-snmp-coders@lists.sourceforge.net
Subject: Re: table handler code when the index is a ASN_OCTET_STR

On Wed, 8 Jul 2015 17:30:44 +0000 Mani wrote:
MP> My use case is I want to be able to a create table data set along 
MP> with the index and column defintions initially. But in a request 
MP> context I want to be able to add rows to the table (say a api call 
MP> to fill the rows of the table). As this data is constantly changing 
MP> I am ok with deleting the previous rows in the table and adding new 
MP> rows everytime the handler is called. How can I go about doing it ?
MP> I saw in the forum one of the posts suggested holding the
MP> netsnmp_table_data_set* reference as a global as there is no way of 
MP> obtaining it with in the helper ? So put simply I want to be able to 
MP> create a table or add rows to a table and access it when the handler gets 
called ...

Take a look at the notification log table. It uses the table_data_set handler, 
and uses a snmp_alarm to periodically trib the table size.

   agent/mibgroup/notification-log-mib/notification_log.c

You say your data is constantly changing - does that mean indexes too? Or just 
the column data? Do you really need tight synchronization for the data, or 
might it be ok to cache for a short period (at least a few seconds, long enough 
that a snmpwalk would return consistent data from a given snapshot)? How often 
do you realistically expect clients to be polling the data?

--
Robert

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need 
to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to