Hello. I would appreciate some help getting started with building a subagent using mib2c and MFD. I'm trying to build a simple example to handle a table. (I did a scalar first, and that seemed worked fine, so this is the next step...)
I have net-snmp version 5.5. I do: > mib2c -c mib2c.mfd.conf netSnmpIETFWGTable (Mostly I select default options. I've tried various permutations. I had to select the non-default m2c_data_transient = 0, otherwise I couldn't get the generated code to compile. I made sure I had a text file at /etc/dummy.conf.) > make -f make -f netSnmpIETFWGTable_Makefile > sudo ./netSnmpIETFWGTable -f -L -DALL NET-SNMP version 5.5 AgentX subagent connected ... Looks good, but then > snmpget -v1 -c public localhost nsIETFWGChair1 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 Below is a snippet from the the subagent debug, which seems to contain a few clues, but I can't work out what's really going wrong. Can anyone help? Thanks, Alec ************ sess_process_packet: session 0x8e3e9f8 fd 7 pkt 0x8e51da8 length 56 trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1472: dumph_recv: AgentX Header trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1473: dumph_recv: Version dumpx_recv: 01 dumpv_recv: Version: 1 trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1480: dumph_recv: Command dumpx_recv: 05 dumpv_recv: Command: 5 (Get) trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1488: dumph_recv: Flags dumpx_recv: 00 dumpv_recv: Flags: 0x0 trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1495: dumph_recv: Reserved Byte dumpx_recv: 00 dumpv_recv: Reserved: 0x0 trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1501: dumph_recv: Session ID dumpx_recv: 05 00 00 00 dumpv_recv: Integer: 5 (0x05) trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1509: dumph_recv: Transaction ID dumpx_recv: 02 00 00 00 dumpv_recv: Integer: 2 (0x02) trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1517: dumph_recv: Packet ID dumpx_recv: 03 00 00 00 dumpv_recv: Integer: 3 (0x03) trace: agentx_parse_header(): mibgroup/agentx/protocol.c, 1524: dumph_recv: Payload Length dumpx_recv: 24 00 00 00 dumpv_recv: Integer: 36 (0x24) trace: agentx_parse(): mibgroup/agentx/protocol.c, 1626: dumph_recv: PDU trace: agentx_parse(): mibgroup/agentx/protocol.c, 1748: dumph_recv: Search Range trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1129: dumph_recv: OID Header dumpx_recv: 07 04 00 00 dumpv_recv: # subids: 7 (0x07) trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1133: dumpv_recv: prefix: 4 (0x04) trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1136: dumpv_recv: inclusive: 0 (0x00) trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1141: dumph_recv: OID Segments parse_oid sizeof(oid) = 4 dumpx_recv: 01 00 00 00 dumpv_recv: Integer: 1 (0x01) dumpx_recv: 88 1F 00 00 dumpv_recv: Integer: 8072 (0x1F88) dumpx_recv: 02 00 00 00 dumpv_recv: Integer: 2 (0x02) dumpx_recv: 02 00 00 00 dumpv_recv: Integer: 2 (0x02) dumpx_recv: 01 00 00 00 dumpv_recv: Integer: 1 (0x01) dumpx_recv: 01 00 00 00 dumpv_recv: Integer: 1 (0x01) dumpx_recv: 02 00 00 00 dumpv_recv: Integer: 2 (0x02) trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1216: dumpv_recv: OID: NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1129: dumph_recv: OID Header dumpx_recv: 00 00 00 00 dumpv_recv: # subids: 0 (0x00) trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1133: dumpv_recv: prefix: 0 (0x00) trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1136: dumpv_recv: inclusive: 0 (0x00) trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1141: dumph_recv: OID Segments parse_oid sizeof(oid) = 4 trace: agentx_parse_oid(): mibgroup/agentx/protocol.c, 1163: dumpv_recv: OID: NULL (0.0) trace: _sess_process_packet(): snmp_api.c, 5416: sess_process_packet: received message id#0 reqid#3 trace: handle_agentx_packet(): mibgroup/agentx/subagent.c, 309: agentx/subagent: handling agentx request (req=0x3,trans=0x2,sess=0x5) trace: handle_agentx_packet(): mibgroup/agentx/subagent.c, 330: agentx/subagent: -> get trace: netsnmp_callback_hook_build(): snmpCallbackDomain.c, 455: transport_callback: hook_build enter trace: netsnmp_callback_hook_build(): snmpCallbackDomain.c, 530: transport_callback: hook_build exit trace: _sess_async_send(): snmp_api.c, 5122: sess_process_packet: sending message id#0 reqid#3 trace: netsnmp_callback_send(): snmpCallbackDomain.c, 239: transport_callback: hook_send enter trace: callback_debug_pdu(): snmpCallbackDomain.c, 91: dump_send_callback_transport: PDU: command = 160, errstat = 0, errindex = 0 trace: callback_debug_pdu(): snmpCallbackDomain.c, 93: dump_send_callback_transport: var 2:trace: sprint_realloc_by_type(): mib.c, 1961: output: sprint_by_type, type 195 trace: sprint_realloc_by_type(): mib.c, 2021: sprint_by_type: bad type: 195 NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 = Wrong Type (should be OCTET STRING): Variable has bad type trace: netsnmp_callback_send(): snmpCallbackDomain.c, 326: transport_callback: hook_send exit trace: _sess_read(): snmp_api.c, 5705: sess_read: not reading 5 (fdset 0xbfaba418 set 0) trace: _sess_read(): snmp_api.c, 5705: sess_read: not reading 3 (fdset 0xbfaba418 set 0) trace: snmp_sess_select_info2(): snmp_api.c, 6188: sess_select: for all sessions: 7 5 (to in 1298023591.117603 sec) 3 sess_select: next alarm 3.552210 sec verbose:sess_select: timer due in 3.552210 sec verbose:sess_select: setting timer to 3.552210 sec, clear block (was 0) trace: _sess_read(): snmp_api.c, 5705: sess_read: not reading 7 (fdset 0xbfaba418 set 0) trace: _sess_read(): snmp_api.c, 5705: sess_read: not reading 5 (fdset 0xbfaba418 set 0) trace: netsnmp_callback_recv(): snmpCallbackDomain.c, 190: transport_callback: hook_recv enter trace: netsnmp_callback_recv(): snmpCallbackDomain.c, 216: transport_callback: hook_recv exit trace: _sess_process_packet(): snmp_api.c, 5357: sess_process_packet: session 0x8dff5e8 fd 3 pkt 0x8e51da8 length 1 trace: callback_debug_pdu(): snmpCallbackDomain.c, 91: dump_recv_callback_transport: PDU: command = 160, errstat = 0, errindex = 0 trace: callback_debug_pdu(): snmpCallbackDomain.c, 93: dump_recv_callback_transport: var 2:trace: sprint_realloc_by_type(): mib.c, 1961: output: sprint_by_type, type 195 trace: sprint_realloc_by_type(): mib.c, 2021: sprint_by_type: bad type: 195 NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 = Wrong Type (should be OCTET STRING): Variable has bad type trace: _sess_process_packet(): snmp_api.c, 5416: sess_process_packet: received message id#0 reqid#3 trace: init_agent_snmp_session(): snmp_agent.c, 1352: snmp_agent: agent_sesion 0x8e3f098 created trace: init_agent_snmp_session(): snmp_agent.c, 1367: verbose:asp: asp 0x8e3f098 reqinfo 0x8e3e028 created trace: netsnmp_subtree_find_first(): agent_registry.c, 288: subtree: looking for subtree for context: "" trace: netsnmp_subtree_find_first(): agent_registry.c, 292: subtree: found one for: "" trace: netsnmp_subtree_find_prev(): agent_registry.c, 1522: wtest: oid in: NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 trace: netsnmp_subtree_find_prev(): agent_registry.c, 1533: wtest: oid cmp: ccitt --- off = 0, in off = 0 test = 1 trace: netsnmp_subtree_find_prev(): agent_registry.c, 1533: wtest: oid cmp: iso --- off = 1, in off = 1 test = 1 trace: netsnmp_subtree_find_prev(): agent_registry.c, 1533: wtest: oid cmp: NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable --- off = 2, in off = 2 test = 1 trace: netsnmp_subtree_find_prev(): agent_registry.c, 1533: wtest: oid cmp: NET-SNMP-EXAMPLES-MIB::netSnmpHostsTable --- off = 10, in off = 11 test = 1 trace: netsnmp_add_varbind_to_cache(): snmp_agent.c, 1947: snmp_agent: add_vb_to_cache(0x8e3f098, 1, NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1, 0x8e00970) trace: netsnmp_add_varbind_to_cache(): snmp_agent.c, 2018: snmp_agent: tp->start NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable, tp->end NET-SNMP-EXAMPLES-MIB::netSnmpHostsTable, trace: netsnmp_add_varbind_to_cache(): snmp_agent.c, 2038: verbose:asp: asp 0x8e3f098 reqinfo 0x8e3e028 assigned to request trace: netsnmp_add_varbind_to_cache(): snmp_agent.c, 2045: verbose:asp: asp 0x8e3f098 reqinfo 0x8e3e028 assigned to request trace: netsnmp_call_handlers(): agent_handler.c, 515: handler:calling: main handler bulk_to_next trace: netsnmp_call_handler(): agent_handler.c, 435: handler:calling: calling handler bulk_to_next for mode GET trace: netsnmp_call_handler(): agent_handler.c, 443: handler:returned: handler bulk_to_next returned 0 trace: netsnmp_call_handler(): agent_handler.c, 435: handler:calling: calling handler table for mode GET trace: table_helper_handler(): table.c, 199: helper:table:req: Got request for handler table: base oid:NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 trace: table_helper_handler(): table.c, 398: helper:table:col: have at least a column (2) trace: table_helper_handler(): table.c, 465: helper:table: not enough for indexes trace: table_helper_handler(): table.c, 522: helper:table: looking for 1 indexes trace: table_helper_handler(): table.c, 531: helper:table: oid indexes not complete: NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 trace: table_helper_handler(): table.c, 576: helper:table:results: found -1220307984 indexes trace: table_helper_handler(): table.c, 622: helper:table: invalid index(es) for table - skipping trace: netsnmp_call_handler(): agent_handler.c, 443: handler:returned: handler table returned 0 trace: netsnmp_handle_request(): snmp_agent.c, 3211: results: request results (status = 0): trace: netsnmp_handle_request(): snmp_agent.c, 3214: results: NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1 = No Such Instance currently exists at this OID Consider the environment before printing this mail. Thales e-Security Limited is incorporated in England and Wales with company registration number 2518805. Its registered office is located at 2 Dashwood Lang Road, The Bourne Business Park, Addlestone, Nr. Weybridge, Surrey KT15 2NX. The information contained in this e-mail is confidential. It may also be privileged. It is intended only for the stated addressee(s) and access to it by any other person is unauthorised. If you are not an addressee or the intended addressee, you must not disclose, copy, circulate or in any other way use or rely on the information contained in this e-mail. Such unauthorised use may be unlawful. If you have received this e-mail in error, please inform us immediately on +44 (0)1223 723600 and delete it and all copies from your system. Commercial matters detailed or referred to in this e-mail are subject to a written contract signed for and on behalf of Thales e-Security Limited. ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ 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