Me again... To see if I reproduce the same problem with the latest version of net-snmp, I try my sample with net-snmp v5.3.1 (instead of v.5.0.11).
The problems I'm facing now are: - the index retrieved with register_int_index is always -1 - I get a long list of error messages 'registering pdu failed: 263!' The sample I test is identical to the sample which was running correctly with net-snmp v5.0.11. Here is the code of my sample: void init_GenServerTable() { oid genServerTableOid[] = { 1, 3, 6, 1, 4, 1, 99999, 10000, 1, 1 }; size_t genServerTableOidLen = OID_LENGTH(genServerTableOid); u_long allocatedIndex = register_int_index(genServerTableOid, genServerTableOidLen, ANY_INTEGER_INDEX); oid genServerAllocatedOid[] = { 1, 3, 6, 1, 4, 1, 99999, 10000, 1, 1, 1, 1 }; size_t genServerAllocatedOidLen = OID_LENGTH(genServerAllocatedOid); genServerAllocatedOid[genServerAllocatedOidLen - 1] = allocatedIndex; netsnmp_table_data_set *genServerTable = netsnmp_create_table_data_set("genServerTable"); netsnmp_table_dataset_add_index(genServerTable, ASN_UNSIGNED); netsnmp_table_set_multi_add_default_row(genServerTable, 2, ASN_OCTET_STR, 0, NULL, 0, 3, ASN_OCTET_STR, 0, NULL, 0, 4, ASN_OCTET_STR, 0, NULL, 0, 5, ASN_UNSIGNED, 0, NULL, 0, 0); netsnmp_handler_registration * handlerServerTable = netsnmp_create_handler_registration ("genServerTable", NULL, genServerAllocatedOid, //genServerAllocatedOid, genServerAllocatedOidLen - 2, //genServerAllocatedOidLen, HANDLER_CAN_RONLY); handlerServerTable->range_subid = genServerAllocatedOidLen - 1; handlerServerTable->range_ubound = 5; int res = netsnmp_register_table_data_set(handlerServerTable, genServerTable, NULL); if ( res != MIB_REGISTERED_OK ) { snmp_log(LOG_ERR,"Unable to register the Server Row: res = %d.\n", res); } // Add a Row netsnmp_table_row *row = netsnmp_create_table_data_row(); snmp_log(LOG_INFO,"Index found=%d.\n", allocatedIndex); netsnmp_table_row_add_index(row, ASN_UNSIGNED, &allocatedIndex, sizeof(allocatedIndex)); netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "Test1", strlen("Test1")); netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "Test2", strlen("Test2")); netsnmp_set_row_column(row, 4, ASN_OCTET_STR, "Test3", strlen("Test3")); u_long pid = 1500; netsnmp_set_row_column(row, 5, ASN_UNSIGNED, (const char *)&pid, sizeof(pid)); netsnmp_table_dataset_add_row(genServerTable, row); } RETSIGTYPE stop_server(int a) { keep_running = 0; } int main (int argc, char **argv) { // print log errors to syslog or stderr snmp_enable_stderrlog(); // Sub-agentX netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1); // Read configuration file netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OPTIONALCONFIG, "App1.conf"); netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_NO_ROOT_ACCESS); netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET, "/home/arnboden/snmp/master"); // Set the communication Port with the master agent netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_PORTS, "1400"); SOCK_STARTUP; // initialize the agent library init_agent("App1"); init_mib_modules(); // Load the table init_GenServerTable(); init_snmp("App1"); keep_running = 1; signal(SIGTERM, stop_server); signal(SIGINT, stop_server); snmp_log(LOG_INFO,"App1 is up and running.\n"); sendSpecificTrap(); while(keep_running) { agent_check_and_process(1); } snmp_shutdown("App1"); SOCK_CLEANUP; return 0; } Any suggestions? Thanks in advance. >From: "Arnaud BODENAN" <[EMAIL PROTECTED]> >To: net-snmp-users@lists.sourceforge.net >Subject: Re: multiple Sub-agents managing the same table >Date: Tue, 05 Sep 2006 15:12:16 +0200 > >At the moment, when I register my first application (App1), it is now well >registered and an snmpwalk on my table gives me now the values I expect: >GEN-MONITORING-MIB::genServerName.1 = STRING: "Test1" >GEN-MONITORING-MIB::genServerProductName.1 = STRING: "Test2" >GEN-MONITORING-MIB::genServerHostname.1 = STRING: "Test3" >GEN-MONITORING-MIB::genServerPID.1 = Gauge32: 1500 > >But, now, I'm not able to register a new server. (I will debug my second >server to see what's going on) > > >From: "Dave Shield" <[EMAIL PROTECTED]> > >To: "Arnaud BODENAN" <[EMAIL PROTECTED]> > >CC: net-snmp-users@lists.sourceforge.net > >Subject: Re: multiple Sub-agents managing the same table > >Date: Tue, 5 Sep 2006 13:32:03 +0100 > > > >On 05/09/06, Arnaud BODENAN <[EMAIL PROTECTED]> wrote: > >>What is nsRegistryTable? I look in the source code of net-snmp and I do > >>not > >>find any occurence of nsRegistryTable. > > > >My apologies. It's actually the 'nsMibRegistry' group > >(containing the 'nsModuleTable'). > > > >It lists all the MIB object that have been registered with the master > >agent. > > > >Dave > >_________________________________________________________________ >Get the new Windows Live Messenger! >http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline > > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job >easier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >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 _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ 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