Forum Discussion
Making SNMP queries in iRules
- Feb 08, 2023
Running an periodic iCall Job in the Config-Plane to query SNMP and write results to a DG would be a much easier and elegant alternative. No? Dealing with ASN1-BER in iRules isn't much fun... 🙂
Cheers, Kai
LiefZimmerman : Good to see that the ordering in DevCentral has finally been changed, so that we can see if something gets added to rather old questions. Thanks!
Related question then. I think I got the packets formatted correctly and have connected a sideband connection using the 'connect' function, and then sent using the 'send' function. The returned number of bytes sent is 40 bytes. But then when I do the recv I don't get anything back.
My code looks like this:
set conn_id [connect -protocol UDP -timeout 100 -status conn_status 192.168.0.1:161]
set send_bytes [send -timeout 1000 -status send_status $conn_id $snmp_packet]
set recv_bytes [recv -timeout 10000 -status recv_status $conn_id recv_packet]
conn_status comes back as "connected"
send_status comes back as "sent"
send_bytes comes back as 40
recv_status comes back as "received" or "closed" depending on how long I make the timeout
recv_bytes comes back as 0
I expect that even if my snmp_packet is not formatted correctly, it should still give me something back rather than 0 bytes.
Any idea what I'm doing wrong? There isn't any example or doc I can see for receiving UDP traffic from a sideband connection, so maybe there is something special I need to do for UDP connections? It feels like the connection is there, the request sent, but the response is coming back over a different port or something like that and the 'recv' command is not able to pick it up.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com