A Management Information Base, or MIB, is a definition of managed objects in a text file. Such files are commonly called “MIB files”, and they are shared between SNMP agents and managers to define a language of objects.
PowerSNMP has already included “standard” MIB files for SNMP-2, generic traps, and some notifications. These are provided in the following namespaces:
- The Dart.PowerSNMP.MibObject namespace includes classes with OIDs that can be used for GetMessage and SetMessage requests. These classes derive from the MibNode class and represent scalar objects (these classes have an IidConst field that returns an IID suitable for use in GetMessage and SetMessage).
- The Dart.PowerSNMP.MibTableColumn namespace includes OIDs that can be used for GetNextMessage and GetBulkMessage requests. These are requests that do not need IIDs as variables, but will return IIDs within the ResponseMessage.Variables collection of the response. If you add a series of objects from the Dart.PowerSNMP.MibTableColumn namespace to the GetNextMessage.Variables collection, then you can effectively retrieve each row of the table being queried.
- The Dart.PowerSNMP.MibTable namespace can also be used for GetNextMessage requests. Since this only provides a single OID, multiple GetNextMessage objects must be sent to walk the table. These are not leaf objects, and cannot have instances associated with them.
- The Dart.PowerSNMP.MibTableEntry namespace provides conceptual definitions of table rows. These objects have limited practical application beyond providing table definition information. These are not leaf objects, and cannot have instances associated with them.
- The Dart.PowerSNMP.MibIdentifier namespace provides definitions of MIB nodes that serve as branch roots and do not have associated IIDs.
- The Dart.PowerSNMP.MibNotification namespace provides definitions of MIB nodes that serve as definitions of notification messages and do not have associated IIDs.
- The Dart.PowerSNMP.MibGroup namespace provides definitions of MIB nodes that serve as definitions of notification and object groups and do not have associated IIDs.
- The Dart.PowerSNMP.Trap namespace provides classes that derive from the TrapMessage class. Six classes are provided, one for each kind of “generic” trap.
- The Dart.PowerSNMP.Notification namespace provides classes that derive from the NotifyMessage class. Three intrinsic classes are provided.
PowerSNMP provides two mechanisms for automatically adding additional classes to these that are already provided. Classes are added to the existing namespaces.
Using the IDE to Parse MIB Files and Add Classes
By “right-clicking” on the Agent or Manager component and choosing “Generate MIB Classes” from the Context Menu, or by choosing the “Generate MIB Classes” in the Properties window, you can interactively create a new C# or VB file of classes.
This dialog shows how multiple source .mib files can be added using the “Select” button, and how status information is generated when the “Generate Classes” button is selected. When you exit this form, you will be asked if you want the source code file added to your project. By choosing “Yes”, the file will be added.
If you are not working in the Visual Studio IDE, or wish to generate MIB class files outside the IDE, please use the included “MibClassGenerator” sample.
NOTE: Dart has tested numerous MIB files for parsing compatibility, but it is possible that the using application may need to process a MIB file that either does not parse well, or will not compile. If not parsing, you can attempt to edit the MIB file to bring it into closer conformance with the specification. Dart provides optional paid support for this kind of problem. If not compiling, you should edit the source code to modify the offending syntax. For example, C# is case-sensitive, whereas Visual Basic is not. So Visual Basic can have a problem with duplicate class names (sysDescr would be confused with SysDescr), whereas C# would not. These will have to be dealt with on a case-by-case basis. Of course, you can always manually construct classes that will provide your application with the benefits of self-documenting type-safety.
In This Section
- Overview
- This topic provides an overview for using PowerSNMP for .NET.
- Placing Components on a Form
- This topic demonstrates how to create and use the components using Visual Studio .NET.
- Creating Components Dynamically
- This topic demonstrates how to add a component as a reference using Visual Studio .NET.
- Synchronous vs. Asynchronous Use
- This topic discusses the benefits and uses for synchronous and asynchronous methods.
- Using Events
- This topic discusses how to use events with the component, both using Visual Studio .NET and in other environments.
- Using Components without Visual Studio
- This topic discusses using the components in an environment other than Visual Studio.
- Parsing MIB Files
- This topic discusses the classes generated when parsing MIB files.
- Namespace and Class Hierarchy
- This topic discusses the namespace and class hierarchy under Dart.PowerSNMP.
PowerSNMP Using Menublock
Send comments on this topic.
Documentation version 1.2.0.0.
© 2008 Dart Communications. All rights reserved.