To run the mibgen tool for our example, go to the examplesDir/current/Snmp/Agent directory and type the following command:
$ mibgen -d . mib_II_subset.txt
This generates the following files in the current directory:
The MBean (by inheritance) for the whole MIB: RFC1213_MIB.java
The MBean and its helper class for the Snmp group: Snmp.java, SnmpMBean.java, SnmpMeta.java
The MBean and its helper class for the System group: System.java, SystemMBean.java, SystemMeta.java
The MBean and its helper class for the Interfaces group: Interfaces.java, InterfacesMBean.java, InterfacesMeta.java
The class representing the Interfaces table, and the MBean representing entries in the table: TableIfTable.java, IfEntry.java, IfEntryMBean.java, IfEntryMeta.java
Classes representing enumerated types used in these groups: EnumSnmpEnableAuthenTraps.java, EnumIfOperStatus.java, EnumIfAdminStatus.java, EnumIfType.java
The OID table for SNMP managers wanting to access this MIB: RFC1213_MIBOidTable.java
The MBean with the name of the MIB is a central administrative class for managing the other MBeans that represent the MIB groups and table entries. All of the other MBeans contain the SNMP variables as attributes of their management interface. The mibgen tool generates standard MBeans for the MIB, so attributes are implemented with individual getter and setter methods.
These MBeans are just skeletons, meaning that the attribute implementations only return a default value. You must implement the getters and setters of the attributes to read and write data with the correct semantic meaning of the SNMP variable.
Because SNMP does not support actions in MIBs, the only operations in these MBeans are checkers associated with the SNMP “Set” request in writeable variables. Again, these are skeleton methods that you must implement to do the checks that you require before the corresponding “Set” operation. You can add operations and expose them in the MBean interface, but the SNMP manager cannot access them. However, other managers can call these operations if they are connected through another protocol.