Template:FAQ:MIBs 07

From Net-SNMP Wiki
Revision as of 12:36, 28 May 2009 by Dts12 (Talk | contribs) (Latest FAQ revision - preparing for 5.5 release)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The way that comments are handled in a MIB file is subtly different to the equivalent syntax in most typical programming languages, and this difference can catch out the unwary. In particular, there are two common situations which can lead to problems.

The first scenario is where the MIB designer has attempted to "comment out" an unwanted line that already contains a comment:

       --   broken ::= { myMIB 1 }   -- This isn't working yet

The assumption here is that a comment continues to the end of the line. Unfortunately, this is not correct. A comment will continue either to the end of the line, or the next occurance of a pair of dashes.

Thus in this case, the definition of "broken" is commented out (as untended) but the following text ("This isn't working yet") is treated as an active part of the MIB, and will generate an error.


The second scenario is where a line of dashes has been used to mark out separate parts of a MIB file. Depending on the exact number of dashes used, this may still result in a syntactically valid MIB file, but has a 1-in-4 possibility of triggering an error. This means that this particular situation can be particularly difficult to spot!


Most of the Net-SNMP applications have a command-line option (-Pc) which will work around this problem by treating the whole line as a comment. But this is not strictly legal, and the offending MIB file should really be corrected.