netsnmp - How to get the size-constraints of a column in net-snmp?
Question
Suppose I have the following code in mib2c.conf:
@foreach $t table@
Starting table $t
@foreach $c column@
echo $t has column $c which has a syntax of $c.syntax
...
@end@
@end@ EOF
How can I get the size-related constraints for column $c
from the MIB file (min/max value for integers or list of accepted values for enums).
I would like to feed these values to netsnmp_chech_vb_XXXX in order to validate some SNMP set requests, but I am not sure how to get them.
Solution
From the mib2c code you'll see the comment below:
# @foreach $RANGE_START, $RANGE_END range NODE@ # repeat iterate over code until @end@ setting $RANGE_START and $RANGE_END # to the legal accepted range set for a given mib NODE.
You'll note that you need to iterate over the ranges. Integers and sizes don't just have a single range much of the time. IE, it's legal to have an integer that must be from 2-4 or from 6-8 with a blank in the middle. The above code will let you loop through every range set.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow