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!
For those wondering, I got this working. It took a bit of work, but I can query for one or more snmp OIDs in my irule now and get the correct responses back. It is as Vernon was saying I get nothing back unless the snmp packet is exactly correct.
In doing this, I found out that the ASN1::encode and ASN1::decode iRule functions don't work to expectation at all. I was using them thinking they would do the right thing but then found out they don't encode/decode properly, so I ended up doing the raw encoding/decoding myself. For example, you would think the below would give you a sequence with two integers inside:
ASN1::encode "(ii)" $firstInteger $secondInteger
but it doesn't. It doesn't put the correct sequence header and length into the encoded bytes. I had trouble with encoding/decoding other things with it too, and there is no way to encode an OID which is needed for SNMP.
Thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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