Search code examples
snmpsnmp4j

How do I implement an SNMP 'getSubtree' PDU type, and support in an SNMP agent for it?


I've implemented an SNMP agent using SNMP4J. I've read in various places (including in SNMP4J javadoc) that there is support for a 'getSubtree' operation, but it always seems to be done from the client side, using getNext and/or getBulk. What I'm trying to do, though, is define a new PDU for 'getSubtree', and implement the server-side agent support for it.

Has anyone successfully (a) implemented a new PDU type (beyond the 7 standard ones) using SNMP4J, and/or (b) implemented 'getSubtree' support within an agent (I already know how to simulate it from a client.) Is either (a) or (b) even possible? Any pointers on how to do either would be GREATLY appreciated!


Solution

  • SNMP is not an extensible protocol that allows you to add new operations to it. So legally, you can't actually do that. The RFCs restrict the PDUs to the existing ones. GETBULK is the most efficient way to gather a bunch of information from an agent, even though it has its own issues with using it (data overrun for example).