Hello,

I have recently run into a problem where "sndMsgMaxSize" would be most
helpful, but is unfortunately not.

I have a number of devices that support such lame message sizes as 490
bytes and even lower.  My code for issuing an SNMPGET, before meeting
these devices, was simply to batch up OIDs in chunks of 20 and send
them off.  I found 20 to be a good number for keeping the PDU size
within acceptable limits of all devices before these.

I have since begun implementing routine scans of
SNMP-FRAMEWORK-MIB::snmpEngineMaxMessageSize.0, and using that value
to determine what the sndMsgMaxSize should be when talking to that
device.  Indeed, I found that I could set sndMsgMaxSize and
snmp_sess_send would even set the error code to SNMPERR_TOO_LONG.
Perfect.

However, after going over the source code, I see that net-snmp will
not break down my PDU and send it for me.

Fine, okay.

My next idea was this:
1. Add all of the OIDs that I want to get to a PDU called "currentPdu".
2. Create an empty PDU called "extraPdu".
3. Loop until "currentPdu" is empty.
3a. Send PDU "currentPdu".
3b. Okay?
3b1. Swap "currentPdu" and "extraPdu".
3b2. Continue to top of loop.
3c. (We didn't send the PDU.)
3d. If the error was NOT "SNMPERR_TOO_LONG", then just quit.
3e. (We need to trim our PDU.)
3f. Remove the LAST varbind from "currentPdu" and add it as the FIRST
varbind on "extraPdu".
3g. Continue to top of loop.

Essentially, if we try to send a message that's too big, we get a
specific error back.  We then keep popping OIDs out of the PDU until
it sends successfully.  We then repeat the process for the second PDU
that stored all of the "too big" OIDs from the original PDU (in their
proper, original order).

I see that there is an "snmp_pdu_add_variable" function to add new
OIDs to a PDU, but I don't see any other varbind manipulation routines
for PDUs that would allow me to accomplish my task of trimming the PDU
down to a manageable size.

Has anyone else encountered this problem?  If so, do you have a good solution?

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to