maddingue / AnyEvent-NetSNMP-agent

AgentX clients with NetSNMP::agent and AnyEvent
0 stars 1 forks source link

Connection problem with snmpd #1

Open maddingue opened 11 years ago

maddingue commented 11 years ago

The module correctly connects to the AgentX socket, but as soon as one tries to snmpget/walk the registered OIDs, it seems there's a communication problem between snmpd and the Perl agent, diagnosed by the message "AgentX master disconnected us, reconnecting in 15" on agent side, and the message "Timeout: No Response from localhost." on client side.

$ sudo /opt/snmp/5.7.2/sbin/snmpd -Le -f -d -V -C -c etc/snmpd.conf,etc/agentx.conf 
Turning on AgentX master support.
NET-SNMP version 5.7.2

Received 80 byte packet from Local IPC: /opt/snmp/5.7.2/var/agentx/master
0000: 01 01 00 00  00 00 00 00  00 00 00 00  10 F5 87 15    ................
0016: 3C 00 00 00  00 00 00 00  05 04 00 00  01 00 00 00    <...............
0032: 88 1F 00 00  03 00 00 00  02 00 00 00  0A 00 00 00    ................
0048: 19 00 00 00  4E 65 74 2D  53 4E 4D 50  20 41 67 65    ....Net-SNMP Age
0064: 6E 74 58 20  73 75 62 2D  61 67 65 6E  74 00 00 00    ntX sub-agent...

Sending 88 bytes to Local IPC: /opt/snmp/5.7.2/var/agentx/master
0000: 01 12 00 00  05 00 00 00  00 00 00 00  10 F5 87 15    ................
0016: 44 00 00 00  D1 0E 00 00  00 00 00 00  04 00 00 00    D...............
0032: 05 04 00 00  01 00 00 00  88 1F 00 00  03 00 00 00    ................
0048: 02 00 00 00  0A 00 00 00  19 00 00 00  4E 65 74 2D    ............Net-
0064: 53 4E 4D 50  20 41 67 65  6E 74 58 20  73 75 62 2D    SNMP AgentX sub-
0080: 61 67 65 6E  74 00 00 00                              agent...

Received 36 byte packet from Local IPC: /opt/snmp/5.7.2/var/agentx/master
0000: 01 03 00 00  05 00 00 00  00 00 00 00  11 F5 87 15    ................
0016: 10 00 00 00  00 7F 00 00  02 04 00 00  01 00 00 00    ................
0032: 10 7E 00 00                                           .~..

Sending 44 bytes to Local IPC: /opt/snmp/5.7.2/var/agentx/master
0000: 01 12 00 00  05 00 00 00  00 00 00 00  11 F5 87 15    ................
0016: 18 00 00 00  D2 0E 00 00  00 00 00 00  05 00 00 00    ................
0032: 02 04 00 00  01 00 00 00  10 7E 00 00                 .........~..

Received 20 byte packet from Local IPC: /opt/snmp/5.7.2/var/agentx/master
0000: 01 0D 00 00  05 00 00 00  00 00 00 00  12 F5 87 15    ................
0016: 00 00 00 00                                           ....

Sending 28 bytes to Local IPC: /opt/snmp/5.7.2/var/agentx/master
0000: 01 12 00 00  05 00 00 00  00 00 00 00  12 F5 87 15    ................
0016: 08 00 00 00  A0 16 00 00  00 00 00 00                 ............
maddingue commented 11 years ago

And, while trying to replicate this, it succeeded in answering the client. Once.

### $ snmpget -v2c -c public localhost .1.3.6.1.4.1.32272.1
### SNMPv2-SMI::enterprises.32272.1 = STRING: "hello"

Received 44 byte packet from UDP: [127.0.0.1]:36851->[127.0.0.1]:161
0000: 30 2A 02 01  01 04 06 70  75 62 6C 69  63 A0 1D 02    0*.....public...
0016: 04 41 E6 10  59 02 01 00  02 01 00 30  0F 30 0D 06    .A..Y......0.0..
0032: 09 2B 06 01  04 01 81 FC  10 01 05 00                 .+..........

Received SNMP packet(s) from UDP: [127.0.0.1]:36851->[127.0.0.1]:161
  GET message
    -- SNMPv2-SMI::enterprises.32272.1

Sending 40 bytes to Local IPC: abstract
0000: 01 05 00 00  05 00 00 00  01 00 00 00  02 00 00 00    ................
0016: 14 00 00 00  03 04 00 00  01 00 00 00  10 7E 00 00    .............~..
0032: 01 00 00 00  00 00 00 00                              ........

Received 60 byte packet from Local IPC: /opt/snmp/5.7.2/var/agentx/master
0000: 01 12 00 00  05 00 00 00  01 00 00 00  02 00 00 00    ................
0016: 28 00 00 00  00 00 00 00  00 00 00 00  04 00 00 00    (...............
0032: 03 04 00 00  01 00 00 00  10 7E 00 00  01 00 00 00    .........~......
0048: 05 00 00 00  68 65 6C 6C  6F 00 00 00                 ....hello...

Sending 49 bytes to UDP: [127.0.0.1]:36851->[127.0.0.1]:161
0000: 30 2F 02 01  01 04 06 70  75 62 6C 69  63 A2 22 02    0/.....public.".
0016: 04 41 E6 10  59 02 01 00  02 01 00 30  14 30 12 06    .A..Y......0.0..
0032: 09 2B 06 01  04 01 81 FC  10 01 04 05  68 65 6C 6C    .+..........hell
0048: 6F                                                    o
maddingue commented 11 years ago

While giving a new shot at this, I was surprised to find that the module does not work when AnyEvent selects EV as backend loop: it somehow hangs in epoll(), and the timers never get called.