Hi Dave,
Thanks again for your support.
First of all I would like to tell you that my Perl version is: "v5.12.2
built for i386-linux-thread-multi".
Secondly I would like to describe the way I would like to bind the values
to my columns: netSnmpPrvOWD and netSnmpPrvATR:
I'm using a program that will write every 1 second in 2 files de values
that I need: eth0_delay.out and eth0_datarate.out.In those files it is
only one row that contains a string[15] that represent the measured
values from my interface. If I understood right, the agent will read those
files every time it has a get request, so practically I got rid of using a
thread. I wanted to use the static values just for
testing but unfortunately I didn't succeed, so that's why I would like to ask
you if is not to
much to help with that piece of code for netSnmpPrvTable_load() that
will bind my values (from files or static).
This is what I have tried to do:
##################################################################################
int
netSnmpPrvTable_load(netsnmp_cache * cache, void *vmagic)
{
netsnmp_tdata *table = (netsnmp_tdata *) vmagic;
netsnmp_tdata_row *row;
FILE *fp;
char buf[STRMAX];
struct netSnmpPrvTable_entry *entry;
printf("Reading file: eth0_delay.out\n");
fp = fopen("/tmp/eth0_delay", "r");
long netSnmpPrvIndex=1;
netsnmp_tdata_row *this;
printf("loading cache: %d\n" ,(int) &cache);
// while (fgets(buf, STRMAX, fp)) {
/*
* Unpick 'buf' to extract the index values...
*/
//////////////////////////////////////////////// Trying to bind static
values/////////
row->data = entry;
strcpy(entry->netSnmpPrvOWD,"1234");
entry->netSnmpPrvOWD_len=4;
strcpy(entry->netSnmpPrvOWD,"4321");
entry->netSnmpPrvOWD_len=4;
entry->netSnmpPrvIndex = 1;
netsnmp_tdata_row_add_index(row, ASN_INTEGER,
&(entry->netSnmpPrvIndex),
sizeof(entry->netSnmpPrvIndex));
netsnmp_tdata_add_row(table,
row);
//////////////////////////////////////////////////////////////////////////////////////
this = netSnmpPrvTable_createEntry(table, netSnmpPrvIndex);
/*
* ... and then populate 'this' with the column values
*/
// }
fclose(fp);
return;
}
############################################################################
when I start the subagent it looks like:
cache created: -1078654040
table refistered: -1078654036
NET-SNMP version 5.5 AgentX subagent connected
netSnmpPrvTable_subagent is up and running.
And then for the request: snmpget -v2c -c public localhost
.1.3.6.1.4.1.8072.9999.9999.1.2.1.2.1
the subagent displays: handling request: 160 and I get the response:
NET-SNMP-MIB2::netSnmpPrvOWD.1 = No Such Instance currently exists at
this OID
So again please help me to fix this.
Stefan Magda
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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