Tutorial MIB Designer & AgenPro
Tutorial MIB Designer & AgenPro
This tutorial aims at providing a practical guide for creating, editing, exporting MIBs and
further integration with SNMP4J. In this way, It will use MIB Designer, for creation and
validation processes and AgenPro for the JAVA classes exporting. The examples throughout
the tutorial are based on the MIB presented in the UC’s first assessment.
Before reading this, please check RFC4841 (C. Heard, "Guidelines for Authors and Reviewers of
MIB Documents", September 2005).
MIB Designer
Figure 1
Figure 2
2 – At the same link in the first step, click on “Evaluate” to register and then to receive in your
e-mail a trial license key. Note that it requires an institutional address, such as,
[email protected].
Figure 3
Figure 4
3 – Open the MIB Designer and insert the key license received by e-mail.
Figure 5
4 – If everything is right, you will be able to insert your MIB specification into the MIB
Designer.
Using the wizard process it is necessary to define the MIB identifiers. In this example the
Common Object Name Prefix was set as “uminhoMIB” and the New MIB Module
Name was set as “UMINHO-GR-MIB”. After that, click on “Next”.
Figure 6
5 – Now (figure 7) you will define the OID of the root object identifier. In this example, it was
defined as enterprises.1 (OID 1.3.6.1.4.1) as root, but for laboratory/academic works you
should use either private.X or experimental.X
Check http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml.
Then click on “Next” and then (figure 8) check both options in order to create the basic
structure of the MIB and then click on “Finish”.
Figure 7
Figure 8
7 – The definition of the MIB starts with some required imports (e.g., DisplayString, OBJECT-
TYPE, etc). In this way, click with right button over “Imports” and then “Import Object…”
Figure 9
8 – In the next window (figure 10), select the import source (e.g. SNMPv2) and then the
objects to be imported (using “Add”). Finalize the process with “OK”.
Figure 10
After the import process, your structure should be like the one depicted on figure 11.
Figure 11
9 – Taking the creation of “intfTable” as an example, open the folder Objects > enterprises >
uminhoMIBRegMIB and using the right botton Add >Table…
Figure 12
Here is where the table will be structured by setting a name, the correspondent OID, status
and description. It is also required the identification of the object related to a table entry (in
the example, it is the “intfEntry”). Include a description and then columns in the table by
clicking on “Add” as shown in figure 13.
Figure 13
10 – As for the MIB sequence, start by the “intfType” column (figure 14). Select the status, add
a description and define the object type, in this case, a read-only “DisplayString”.
Figure 14
In the next step, the column “intfNumber” was added. Please note that it is necessary to
include a range definition for the INTEGER object type. In figure 15 the range was set between
0 and 1000.
11 – After the creation of all columns it is necessary to indicate which columns uniquely
identify an entry (will be the key for the table). In our case, it will be the columns infType and
intfNumber. Use the botton “Add”, as shown in the figure 16 and then click on “Save”.
Figure 15
Figure 16
Figure 17
Finally, select the objects in order to add to the group and click on “Save” (figure 18).
Figure 18
Figure 19
Figure 20
Now, return to the folder uminhoMIBGroups and select the object NOTIFICATION-TYPE (just
created) through the option Add > Group > Notification-Group, and Save (figure 21).
Figure 21
14 – To export the MIB, use the option File > Save all and then export as “Plain Text” through
the option File > Export MIBs (as in figure 22).
Figure 22
AgenPro
Figure 23
16 – In the context menu, import the TXT file generated in the previous step 14 by selecting
the option File > Import MIB (as in figure 24).
Figure 24
17 – Update the MIB tree and check if the structure was correctly imported (figure 25).
Figure 25
18 – In order to export the MIB for JAVA, click on Project > Edit…, then, in the option
“Templastes Root Directory” insert the folder path in which the AgenPro was installed and
choose the most recent snmp4j-agent folder into templates (in example of figure 26 the
D:\agenpro4\templates\snmp4j-agent_2_5 was selected). Then click on “Add New”
Figure 26
19 – In the template choosing process, clear the folder path, keeping only the template name.
Use figure 27 as reference for the template selection. Note that the Output field defines the
folder in which the java files will be generated.
Figure 27
20 – Click on Next and check the box with “Use all MIB modules available MIB repository” and
then “Finish” (figure 28).
Figure 28
21 – In order to generate the java file, select the option Project > Generate (figure 29). You will
receive a message and can see such files in the folder identified in step 19.
Figure 29
Figure 30
23 – You first have to download some SNMP4J libraries (i.e., SNMP4J sources and library and
SNMP4J-Agent) from the link http://www.snmp4j.org/html/download.html (figure 31).
Figure 31
24 – Set a new Project in your IDE and import the libraries indicated in step 23.
Figure 32
25 – Finally, integrate the source generated by the AgenPro. Things should seem similar to
what appears on figure 33. Now, your MIB is integrated with the SNMP4J and you can
implement the desired functions.
Figure 34
intfTable OBJECT-TYPE
SYNTAX SEQUENCE OF IntfEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "This entity's interfaces table."
::= { mib-ii 99 }
intfEntry OBJECT-TYPE
SYNTAX IntfEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"An entry for Information about an entity’s interface. The key
for the table is formed by the type and number of the
interface."
INDEX { intfType intfNumber }
::= { intfTable 1 }
intfType OBJECT-TYPE
SYNTAX DisplayString
ACCESS read
STATUS mandatory
DESCRIPTION
"The type of interface. Allowed values:
- ‘eth’ for wired Ethernet interfaces;
- ‘ser’ for Serial interfaces;
- ‘wifi’ for wireless interfaces;
- ‘other’ for all other types."
::= { intfEntry 1 }
intfNumber OBJECT-TYPE
SYNTAX INTEGER
ACCESS read
STATUS mandatory
DESCRIPTION
"The number of the interface in the group of interfaces with
the same type."
::= { intfEntry 2 }
intfStatus OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The status of the interface: ‘1’ means OK, ‘2’ means ERROR,
‘3’ means OFF, ‘4’ means UP and ‘5’ means DOWN. Managers can set
values UP/DOWN to enable/disable the interface."
::= { intfEntry 3 }
intfDescription OBJECT-TYPE
SYNTAX DisplayString
ACCESS read-write
STATUS mandatory
DESCRIPTION
"A text description about the interface."
::= { intfEntry 4 }