[AGENT++] subagent mib register with context and net-snmp does not work?
Claus Klein
claus.klein at arcormail.de
Fri Aug 6 22:39:11 CEST 2010
Hi Frank,
for me it is a AgentX++ problem.
Did you receive my log file?
The subagent AgentX Response is wrong coded in case of a get request
with context:
There is an invalid nonDefaultContext flag set, what is not allowed!
And the context is empty too or the rest fields?
I think, the res.sysuptime is also missing?
see http://tools.ietf.org/html/rfc2741#page-43
RFC 2741 AgentX January 2000
6.2.16. The agentx-Response-PDU
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| h.version (1) | h.type (18) | h.flags | <reserved> |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| h.sessionID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| h.transactionID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| h.packetID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| h.payload_length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| res.sysUpTime |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| res.error | res.index |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
...
dumpx_recv: 24 00 00 00
dumpv_recv: Integer: 36 (0x24)
dumph_recv: AgentX Header
dumph_recv: Version
dumpx_recv: 01
dumpv_recv: Version: 1
dumph_recv: Command
dumpx_recv: 12
dumpv_recv: Command: 18 (Response)
dumph_recv: Flags
dumpx_recv: 08
dumpv_recv: Flags: 0x8 <<<<<<<<<<<<<< wrong!
dumph_recv: Reserved Byte
dumpx_recv: 00
dumpv_recv: Reserved: 0x0
dumph_recv: Session ID
dumpx_recv: 08 00 00 00
dumpv_recv: Integer: 8 (0x08)
dumph_recv: Transaction ID
dumpx_recv: 02 00 00 00
dumpv_recv: Integer: 2 (0x02)
dumph_recv: Packet ID
dumpx_recv: 03 00 00 00
dumpv_recv: Integer: 3 (0x03)
dumph_recv: Payload Length
dumpx_recv: 24 00 00 00
dumpv_recv: Integer: 36 (0x24)
dumph_recv: Context <<<<<<<<<<<<< misinterpreted by net-snmp?
dumpx_recv: 00 00 00 00
dumpv_recv: Integer: 0 (0x00)
dumpx_recv: 00 00 00 00
dumpv_recv: String:
dumph_recv: PDU
dumpx_recv: 00 00 00 00
dumpv_recv: Integer: 0 (0x00)
dumpx_recv: 43 00
dumpv_recv: Short: 67 (0x43)
dumpx_recv: 00 00
dumpv_recv: Short: 0 (0x00)
dumph_recv: VarBindList
dumph_recv: VarBind:
dumph_recv: Type
dumpx_recv: 04 02
dumpv_recv: Short: 516 (0x204)
dumph_recv: OID Header
dumpx_recv: 01 00 00 00
dumpv_recv: # subids: 1 (0x01)
dumpv_recv: prefix: 0 (0x00)
dumpv_recv: inclusive: 0 (0x00)
dumph_recv: OID Segments
dumpx_recv: 01 00 00 00
dumpv_recv: Integer: 1 (0x01)
dumpv_recv: OID: iso
agentx/master: timeout on session 00A514B8
agentx/master: close 00A514B8, -1
On 06.08.2010, at 22:05, Frank Fock wrote:
>
>
> Hi Claus,
> The log shows that the context is correctly processed by the subagent.
> It seems to some other problem. Have switched all the workarounds
> for NET-SNMP master agent bugs?
> Best regards,
> Frank
>
> Am 06.08.2010 um 20:26 schrieb Claus Klein <claus.klein at arcormail.de>:
>
>> Hi Frank,
>>
>> the registration works with context, but the walk does not!
>>
>> Here is the agentX++/example subagent debug output when I do the
>> following:
>>
>> claus-kleins-macbook-pro:net-snmp-5.5 clausklein$ snmpwalk -r 0 -
>> v3 -u claus localhost vacmContextTable
>> SNMP-VIEW-BASED-ACM-MIB::vacmContextName."" = STRING:
>> SNMP-VIEW-BASED-ACM-MIB::vacmContextName."subagent" = STRING:
>> subagent
>> claus-kleins-macbook-pro:net-snmp-5.5 clausklein$ snmpwalk -r 0 -
>> v3 -u claus localhost sysUpTime.0
>> DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (294812) 0:49:08.12
>> claus-kleins-macbook-pro:net-snmp-5.5 clausklein$ snmpwalk -r 0 -O
>> n -v3 -u claus -n subagent localhost sysUpTime.0
>> Timeout: No Response from localhost
>> claus-kleins-macbook-pro:net-snmp-5.5 clausklein$
>>
>> #########################################
>>
>> 20100806.20:08:58: 11451: (1)INFO : SubAgentXMib: PING response
>> received (sid)(tid)(pid)(uptime): (5), (10), (20), (297992)
>> 20100806.20:09:00: 11451: (4)DEBUG : AgentXSlave: received
>> something on ports
>> 20100806.20:09:00: 11451: (2)EVENT : AgentXRequestList: request
>> received (context)(tid)(pid)(siz)(type)(err)(status): (subagent),
>> (96), (97), (0), (6), (0), (0)
>> 20100806.20:09:00: 11451: (1)DEBUG : TaskManager: task manager found
>> 20100806.20:09:00: 11451: (2)DEBUG : TaskManager: after notify
>> 20100806.20:09:00: 11451: (2)EVENT : SubAgent: starting thread
>> execution
>> 20100806.20:09:00: 11451: (2)EVENT : SubAgentXMib: GETNEXT (tid)
>> (pid)(oid)...: (96), (97), ( 31 2E 33 2E 36 2E 31 2E 32 2E 31 2E
>> 31 2E 33 2E 1.3.6.1.2.1.1.3.
>> 30 00 00 00 00 00 00 00 00 00 00 00 01 00 08 00 0...............
>> 00 00 00 00 03 00 00 C0 F3 00 00 00 01 00 00 00 ................
>> 01 00 ..
>> )
>> 20100806.20:09:00: 11451: (3)EVENT : Mib: process subrequest:
>> getnext request, oid: (96), (1.3.6.1.2.1.1.3.0)
>> 20100806.20:09:00: 11451: (3)DEBUG : SubAgentXMib: find next
>> (lower)(upper)(incl)(succ): (1.3.6.1.2.1.1.3.0),
>> (1.3.6.1.2.1.1.3.1), (FALSE), (1.3.6.1.4.1.4976.6.1.1.2.71)
>> 20100806.20:09:00: 11451: (3)DEBUG : SubAgentXMib: find next
>> (failed)
>> 20100806.20:09:00: 11451: (3)EVENT : RequestList: finished
>> subrequest (ind)(oid)(val)(syn): (0), (1.3.6.1.2.1.1.3.0), (), (130)
>> 20100806.20:09:00: 11451: (3)EVENT : AgentX: sending agentx pdu
>> (sd)(type)(sid)(tid)(pid)(err)(errind): (3), (18), (5), (96), (97),
>> (0), (0)
>> 20100806.20:09:00: 11451: (4)EVENT : RequestListAgentX: request
>> answered (id)(status)(tid)(err)(removed)(sz): (96), (0), (96), (0),
>> (1), (1)
>> 20100806.20:09:00: 11451: (2)EVENT : Agent: finished thread
>> execution
>> 20100806.20:09:05: 11451: (4)DEBUG : AgentXSlave: received
>> something on ports
>> 20100806.20:09:05: 11451: (1)ERROR : AgentXSlave: lost connection
>> with master
>> 20100806.20:09:05: 11451: (1)DEBUG : Thread: ended (tid):
>> (-1342033920)
>> 20100806.20:09:05: 11451: (4)DEBUG : Thread: joined thread
>> successfully (tid): (-1342033920)
>> 20100806.20:09:05: 11451: (1)DEBUG : Thread: ended (tid):
>> (-1342107648)
>> 20100806.20:09:05: 11451: (4)DEBUG : Thread: joined thread
>> successfully (tid): (-1342107648)
>> 20100806.20:09:05: 11451: (1)DEBUG : TaskManager: thread stopped
>> 20100806.20:09:05: 11451: (1)DEBUG : Thread: ended (tid):
>> (-1341960192)
>> 20100806.20:09:05: 11451: (4)DEBUG : Thread: joined thread
>> successfully (tid): (-1341960192)
>> 20100806.20:09:05: 11451: (1)DEBUG : TaskManager: thread stopped
>> 20100806.20:09:05: 11451: (1)DEBUG : Thread: ended (tid):
>> (-1341886464)
>> 20100806.20:09:05: 11451: (4)DEBUG : Thread: joined thread
>> successfully (tid): (-1341886464)
>> 20100806.20:09:05: 11451: (1)DEBUG : TaskManager: thread stopped
>> 20100806.20:09:05: 11451: (1)DEBUG : Thread: ended (tid):
>> (-1341812736)
>> 20100806.20:09:05: 11451: (4)DEBUG : Thread: joined thread
>> successfully (tid): (-1341812736)
>> 20100806.20:09:05: 11451: (1)DEBUG : TaskManager: thread stopped
>> 20100806.20:09:05: 11451: (1)DEBUG : Thread: ended (tid):
>> (-1341739008)
>> 20100806.20:09:05: 11451: (4)DEBUG : Thread: joined thread
>> successfully (tid): (-1341739008)
>> 20100806.20:09:05: 11451: (1)DEBUG : TaskManager: thread stopped
>> claus-kleins-macbook-pro:build clausklein$
>>
>> ############################################################################
>>
>> claus-kleins-macbook-pro:AgentPro clausklein$ sudo /usr/local/sbin/
>> snmpd -C -c /etc/snmp/snmpd.conf -Le -f -Dagentx
>> registered debug token agentx, 1
>> agentx_register_app_config_handler: registering .conf token for
>> "agentxsocket"
>> agentx_register_app_config_handler: registering .conf token for
>> "agentxperms"
>> agentx_register_app_config_handler: registering .conf token for
>> "agentxRetries"
>> agentx_register_app_config_handler: registering .conf token for
>> "agentxTimeout"
>> Turning on AgentX master support.
>> agentx/config: port spec: tcp:localhost:705
>> agentx/config/retries: 0
>> agentx/config/timeout: 5 # (seconds)
>> agentx/master: initializing...
>> agentx/master: initializing... DONE
>> NET-SNMP version 5.5
>> agentx/master: unexpected callback op 4
>> agentx/master: handle pdu (req=0x1,trans=0x0,sess=0x0)
>> agentx/master: open 0x389bd0
>> agentx/master: opened 0x389fd0 = 5 with flags = a0
>> agentx/master: send response, stat 0 (req=0x1,trans=0x0,sess=0x0)
>> agentx_build: packet built okay
>> agentx/master: handle pdu (req=0x2,trans=0x0,sess=0x5)
>> agentx/master: send response, stat 0 (req=0x2,trans=0x0,sess=0x5)
>> agentx_build: packet built okay
>> agentx/master: handle pdu (req=0x3,trans=0x1,sess=0x5)
>> agentx/master: in register_agentx_list
>> agentx/master: registered ok
>> agentx/master: send response, stat 0 (req=0x3,trans=0x1,sess=0x5)
>> agentx_build: packet built okay
>> agentx/master: handle pdu (req=0x4,trans=0x2,sess=0x5)
>> agentx/master: in register_agentx_list
>> agentx/master: registered ok
>> agentx/master: send response, stat 0 (req=0x4,trans=0x2,sess=0x5)
>> agentx_build: packet built okay
>> agentx/master: handle pdu (req=0x6,trans=0x3,sess=0x5)
>> agentx/master: send response, stat 0 (req=0x6,trans=0x3,sess=0x5)
>> agentx_build: packet built okay
>> agentx/master: agentx master handler starting, mode = 0xa1
>> agentx/master: request for variable (DISMAN-EVENT-
>> MIB::sysUpTimeInstance)
>> agentx/master: EXCLUSIVE varbind DISMAN-EVENT-
>> MIB::sysUpTimeInstance scoped to SNMPv2-MIB::sysUpTime.1
>> agentx: sending pdu (req=0x3,trans=0x2,sess=0x5)
>> agentx_build: packet built okay
>> agentx/master: timeout on session 0x389bd0
>> agentx/master: close 0x389bd0, -1
>> agentx/master: close transport
>>
>>
>> #########################
>>
>> And here is a net-snmp send/recv dump:
>>
>>
>>
>>
>> I hope this helps.
>>
>> Best regards,
>>
>> Claus
>>
>>
>>
>>
>> On 05.08.2010, at 23:51, Frank Fock wrote:
>>
>>> Hi Claus,
>>>
>>> Then it should indeed work. Do you have a log of the
>>> AgentX messages sent by the subagent and returned
>>> by the master agent?
>>>
>>> Best regards,
>>> Frank
>>>
>>> Claus Klein schrieb:
>>>> Hi Frank,
>>>>
>>>> the current net-snmp supports contexts. It use it for the
>>>> snmptrapd, which is a subagent when started with -x option
>>>> and register its mibs at snmptrpad context. That works fine.
>>>>
>>>> Bets regards,
>>>> Claus
>>>>
>>>> On 04.08.2010, at 23:20, Frank Fock wrote:
>>>>
>>>>
>>>>> Hi Claus,
>>>>>
>>>>> Version 4.2.1 of NET-SNMP did not support AgentX contexts.
>>>>> I do not know if that has changed now.
>>>>>
>>>>> Best regards,
>>>>> Frank
>>>>>
>>>>> Claus Klein schrieb:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I tried to register a MIB at a owne context, but the MIB is
>>>>>> registered at the default context?
>>>>>>
>>>>>> The Master agent is the current net-snmp 5.5 on windows or
>>>>>> cygwin.
>>>>>>
>>>>>>
>>>>>> I use the mib code generated with AgentGen V3.0:
>>>>>>
>>>>>> init(*mib);
>>>>>> module_init("mycontext", mib);
>>>>>>
>>>>>> ^^^^^^^^^^
>>>>>>
>>>>>> I think, this should work, or not?
>>>>>>
>>>>>> Claus _______________________________________________
>>>>>> AGENTPP mailing list
>>>>>> AGENTPP at agentpp.org
>>>>>> http://lists.agentpp.org/mailman/listinfo/agentpp
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> AGENTPP mailing list
>>>> AGENTPP at agentpp.org
>>>> http://lists.agentpp.org/mailman/listinfo/agentpp
>>>>
>>>
>>>
>>
>> _______________________________________________
>> AGENTPP mailing list
>> AGENTPP at agentpp.org
>> http://lists.agentpp.org/mailman/listinfo/agentpp
More information about the AGENTPP
mailing list