Search code examples
attributesnet-snmpmib

mib2c - show all variable attributes


I am very new to mib2c, and I need to list all attributes which belong to one variable. I work with mib2c tool from NET-SNMP and there are configuration templates for generating the code.

There are variables with many attributes, look like:

$var.defval
$var.type

I would like to see all these attributes, in order to use them in the generated code. I know, for mib2c attributes there is man page, but there is not everything. (For example I know the attribute $var.needlength exists, and it is not mentioned in that man page).

I don't know how the $var is defined and fulfilled.

How can I list all attributes of $var?


Solution

  • I'm not sure how you can do this programmatically, given the constraints of the mib2c pseudo-Perl but I just looked in /usr/bin/mib2c (it's a script, not a compiled executable so you can easily examine the code) and found the following.

    There are only four undocumented variables in the mib2c script:

    • lastchange
    • storagetype
    • needlength
    • enumrange

    There are many more documented variables in the mib2c script:

    • uc
    • objectID
    • commaoid
    • oidlength
    • subid
    • module
    • parent
    • isscalar
    • iscolumn
    • children
    • perltype
    • type
    • decl
    • readable
    • settable
    • creatable
    • noaccess
    • accessible
    • rowstatus
    • hasdefval
    • defval
    • hashint
    • hint
    • ranges
    • enums
    • access
    • status
    • syntax
    • reference
    • description

    That being said, I'm not sure what exactly you are hoping to find, so I'm not sure that this really answers your question.