Re: problem in SNMPSET on table with string data type columns
Hi Bill, Thanks for the reply. Here for registration of the table we are using below functions: netsnmp_create_handler_registration netsnmp_create_table_data netsnmp_table_helper_add_indexes netsnmp_register_table The problem we are facing is that if our table is columns, c1, c2, and c3, and if c1 is of string data type. Now if we are doing “snmpset c1 val1 c2 val2 c3 val3” we are getting these values val1, val2 and val3 properly in code and they are getting properly updated in the table. But if we are giving columns in different order like “snmpset c3 val3 c1 val1 c2 val2” now we are not getting the val1 value of string column c1 , what we gave in the SNMPSET. For integer columns we are getting proper values irrespective of their order in SNMPSET command. But if we are not giving the string column in proper order in SNMPSET we are not getting its value. Only getting some garbage value (integer value of pervious column value in snmpset). Could you please advise what could be the issue here? Thanks and regards S Sarath On Wednesday, September 3, 2014 7:38 PM, Bill Fenner fen...@gmail.com wrote: I've had trouble with multiple requests in ordered table_iterator tables. I have no idea if that's what you're using, since you didn't give much info about your use case. I just worked around it by injecting the serialize handler: int result = netsnmp_register_table_iterator( reg, iinfo ); assert( result == MIB_REGISTERED_OK ); int injected = netsnmp_inject_handler( reg, netsnmp_get_serialize_handler() ); assert( injected == SNMPERR_SUCCESS ); Bill On Wed, Sep 3, 2014 at 3:19 AM, sarath azad saraths...@yahoo.co.in wrote: Hello, Could you please help in solving the below problem, in doing SNMPSET for tables with string data? thanks and regards S Sarath On Friday, August 22, 2014 9:03 PM, sarath azad saraths...@yahoo.co.in wrote: Hello, Could you please help in resolving the below issue? For SNMPSET on a table which contains a column of string data type, if we are giving values of all the columns in the single SNMPSET query, then we are getting the values of the string column properly, only if the order of column values, in the query is same as the order of column in the table. ie. snmpset -v 2c -c public system-IP column 1 column 1 value column 2 column 2 value ... If we are giving the values in the query in different order, then for integer columns we are getting values properly as given in the query. But for the string columns we are only getting some junk characters or value in the previous column in the query. The table handler function is written as below: Int tableHandlerFunction (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { netsnmp_request_info *request; netsnmp_table_request_info *table_info; char data[100]; for (request = requests; request; request = request-next) { table_info = netsnmp_extract_table_info(request); switch (reqinfo-mode) { case MODE_SET_ACTION: switch (table_info-colnum) { case COLUMN_STRING_COLUMN: strcpy( data , requests-requestvb-val.string)); break; thanks and regards S Sarath -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Net-snmp-users mailing list net-snmp-us...@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Net-snmp-users mailing list net-snmp-us...@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: problem in SNMPSET on table with string data type columns
The only advice I have is to try the serialize handler. Bill On Thu, Sep 4, 2014 at 3:33 AM, sarath azad saraths...@yahoo.co.in wrote: Hi Bill, Thanks for the reply. Here for registration of the table we are using below functions: netsnmp_create_handler_registration netsnmp_create_table_data netsnmp_table_helper_add_indexes netsnmp_register_table The problem we are facing is that if our table is columns, c1, c2, and c3, and if c1 is of string data type. Now if we are doing “snmpset c1 val1 c2 val2 c3 val3” we are getting these values val1, val2 and val3 properly in code and they are getting properly updated in the table. But if we are giving columns in different order like “snmpset c3 val3 c1 val1 c2 val2” now we are not getting the val1 value of string column c1 , what we gave in the SNMPSET. For integer columns we are getting proper values irrespective of their order in SNMPSET command. But if we are not giving the string column in proper order in SNMPSET we are not getting its value. Only getting some garbage value (integer value of pervious column value in snmpset). Could you please advise what could be the issue here? Thanks and regards S Sarath On Wednesday, September 3, 2014 7:38 PM, Bill Fenner fen...@gmail.com wrote: I've had trouble with multiple requests in ordered table_iterator tables. I have no idea if that's what you're using, since you didn't give much info about your use case. I just worked around it by injecting the serialize handler: int result = netsnmp_register_table_iterator( reg, iinfo ); assert( result == MIB_REGISTERED_OK ); int injected = netsnmp_inject_handler( reg, netsnmp_get_serialize_handler() ); assert( injected == SNMPERR_SUCCESS ); Bill On Wed, Sep 3, 2014 at 3:19 AM, sarath azad saraths...@yahoo.co.in wrote: Hello, Could you please help in solving the below problem, in doing SNMPSET for tables with string data? thanks and regards S Sarath On Friday, August 22, 2014 9:03 PM, sarath azad saraths...@yahoo.co.in wrote: Hello, Could you please help in resolving the below issue? For SNMPSET on a table which contains a column of string data type, if we are giving values of all the columns in the single SNMPSET query, then we are getting the values of the string column properly, only if the order of column values, in the query is same as the order of column in the table. ie. snmpset -v 2c -c public system-IP column 1 column 1 value column 2 column 2 value ... If we are giving the values in the query in different order, then for integer columns we are getting values properly as given in the query. But for the string columns we are only getting some junk characters or value in the previous column in the query. The table handler function is written as below: Int tableHandlerFunction (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { netsnmp_request_info *request; netsnmp_table_request_info *table_info; char data[100]; for (request = requests; request; request = request-next) { table_info = netsnmp_extract_table_info(request); switch (reqinfo-mode) { case MODE_SET_ACTION: switch (table_info-colnum) { case COLUMN_STRING_COLUMN: strcpy( data , requests-requestvb-val.string)); break; thanks and regards S Sarath -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Net-snmp-users mailing list net-snmp-us...@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Net-snmp-users mailing list net-snmp-us...@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
MFD compiled extension agent: snmpget returns Timeout: No Response from localhost:1161.
I'm new to Linux. I'm writing an SNMP extension agent using the MIB for Dummies (http://www.net-snmp.org/wiki/index.php/MIB_for_Dummies) config file (mib2c.mfd.conf). I successfully created my executable, adeSensorsTable, using my own adeSensorsTable.MIB (mib2c util auto-generated the C source code from adeSensorsTable.MIB, using mib2c.mfd.conf config file, which I compiled into an executable). I then ran my executable: On my 1st terminal, I typed: ./adeSensorsTable -f -L -DadeSensorsTable -M localhost:1161 It returns: No log handling enabled - turning on stderr logging registered debug token adeSensorsTable, 1 adeSensorsTable:init_adeSensorsTable: Registering adeSensorsTable as a mibs-for-dummies table. - On my 2nd terminal of the same PC: I then tried to use snmpget to reach one of my extension agent objects: To do that I first got the object OID using snmptranslate: snmptranslate -On x-MIB::adeSensorsTable.aDESensorsEntry.vrms and got: .1.3.6.1.4.1.43905.1.1.1.1.2 I then ran: snmpget -v 1 -c public localhost:1161 .1.3.6.1.4.1.43905.1.1.1.1.2 It returns: Timeout: No Response from localhost:1161. - Back on the 1st terminal where my snmp extension agent binary is running, adeSensorsTable, I have : Connection from UDP: [127.0.0.1]:55176-[127.0.0.1] Connection from UDP: [127.0.0.1]:55176-[127.0.0.1] Connection from UDP: [127.0.0.1]:55176-[127.0.0.1] Connection from UDP: [127.0.0.1]:55176-[127.0.0.1] Connection from UDP: [127.0.0.1]:55176-[127.0.0.1] I'm stumped here! I'd appreciate if you someone can provide some pointers on this. Thanks in advance! -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders