Hi
I'm trying to extend the agent with my own MIB using mib2c and the MIB
For Dummies framework.
I've read the ifTable tutorial on net-snmp.org.
The agent works fine and I can do a snmpwalk on the table, but when
the container-cache reloads snmpwalk gives an empty result (no error).
The cache-timeout is set to 10 seconds. When the cache reloads the new
table data is fetched from an external data source by ip/udp (the
get_fft_hold function call) . By monitoring the network traffic I can
confirm that the external data is fetched properly.
Why is the cache reload failing?
My _cache_load function from _data_access.c is copy/pasted below.
Regards
Jon Neerup Lassen
int
fftHoldTable_cache_load(netsnmp_container * container)
{
ftHoldTable_rowreq_ctx *rowreq_ctx;
size_t count = 0;
/*
* temporary storage for index values
*/
/*
* binNumber(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h
*/
long binNumber;
long fftBinValue;
DEBUGMSGTL(("verbose:fftHoldTable:fftHoldTable_cache_load",
"called\n"));
//For fft_data
unsigned short fft_data[FFT_SIZE];
/*
* Fetch fft_data from external data source (fpga) using ip/udp
*/
if(get_fft_hold(fft_data) == -1)
return MFD_RESOURCE_UNAVAILABLE;
/*
* TODO:351:M: |-> Load/update data in the fftHoldTable container.
* loop over your fftHoldTable data, allocate a rowreq context,
* set the index(es) [and data, optionally] and insert into
* the container.
*/
for(count=0;count<FFT_SIZE;count++) {
binNumber = count;
fftBinValue = fft_data[count];
/*
* TODO:352:M: | |-> set indexes in new fftHoldTable rowreq
context.
*/
rowreq_ctx = fftHoldTable_allocate_rowreq_ctx();
if (NULL == rowreq_ctx) {
snmp_log(LOG_ERR, "memory allocation failed\n");
return MFD_RESOURCE_UNAVAILABLE;
}
if (MFD_SUCCESS != fftHoldTable_indexes_set(rowreq_ctx,
binNumber)) {
snmp_log(LOG_ERR, "error setting index while loading "
"fftHoldTable cache.\n");
fftHoldTable_release_rowreq_ctx(rowreq_ctx);
continue;
}
/*
* TODO:246:r: |-> Define fftBinValue mapping.
* Map values between raw/native values and MIB values
*
* Integer based value can usually just do a direct copy.
*/
rowreq_ctx->data.fftBinValue = fftBinValue;
/*
* insert into table container
*/
CONTAINER_INSERT(container, rowreq_ctx);
}
DEBUGMSGT(("verbose:fftHoldTable:fftHoldTable_cache_load",
"inserted %d records\n", count));
return MFD_SUCCESS;
} /* fftHoldTable_cache_load */
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders