0% found this document useful (0 votes)
24 views

Tutorial MIB Designer & AgenPro

This tutorial provides instructions for creating MIBs using MIB Designer, exporting them to text format, and generating Java classes from the MIBs using AgenPro. It then describes integrating the generated Java classes with SNMP4J. The key steps covered are: 1. Downloading and registering for MIB Designer and AgenPro. 2. Creating a MIB structure including tables, columns, groups and notifications in MIB Designer. 3. Exporting the MIB as text. 4. Importing the text MIB into AgenPro. 5. Generating Java classes from the MIB using AgenPro and a SNMP4J template.

Uploaded by

David Santos
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Tutorial MIB Designer & AgenPro

This tutorial provides instructions for creating MIBs using MIB Designer, exporting them to text format, and generating Java classes from the MIBs using AgenPro. It then describes integrating the generated Java classes with SNMP4J. The key steps covered are: 1. Downloading and registering for MIB Designer and AgenPro. 2. Creating a MIB structure including tables, columns, groups and notifications in MIB Designer. 3. Exporting the MIB as text. 4. Importing the text MIB into AgenPro. 5. Generating Java classes from the MIB using AgenPro and a SNMP4J template.

Uploaded by

David Santos
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Departamento de Informática, Universidade do Minho

Tutorial MIB Designer & AgenPro


João Marco Silva & Bruno Dias
Universidade do Minho – Departamento de Informática
Janeiro 2017

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

1 – Download the tool from http://agentpp.com/tools/mibdesigner.html. The figures below


show the required steps.

Figure 1

Page 1, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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

Page 2, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Figure 4

3 – Open the MIB Designer and insert the key license received by e-mail.

Figure 5

Page 3, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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”.

Page 4, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Figure 7

Figure 8

Page 5, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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

Page 6, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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.

Page 7, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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”.

Page 8, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Figure 15

Figure 16

12 – To finish the MIB creation it is also necessary to create an OBJECT-GROUP and a


NOTIFICATION-GROUP. To do this, open the folder uminhoMIBConf and with the right button
over uminhoMIBGroups, select the option Add > Group > Object-Group, as in figure 17.

Page 9, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Figure 17

Finally, select the objects in order to add to the group and click on “Save” (figure 18).

Figure 18

13 – For the NOTIFICATION-GROUP it is also necessary to create a NOTIFICATION-TYPE by


selecting the option Add > Notification-Type in the uminhoMIBEvents folder (figure 19).

Page 10, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Figure 19

Select the objects and Save (figure 20).

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).

Page 11, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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).

Page 12, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Figure 22

Page 13, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

AgenPro

15 – Download the tool from http://agentpp.com/tools/agenpro.html. It will be necessary a


new register (similarly to what was done for MIB Designer).

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

Page 14, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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

Page 15, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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

Page 16, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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

22 – Figure 30 shows the underlying java class.

Figure 30

Page 17, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Integrating the source with SNMP4J

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

Page 18, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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

Page 19, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

Part of the MIB specification example used in this


this tutorial

-- The alternative Interfaces table

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 }

IntfEntry ::= SEQUENCE {


intfType DisplayString,
intfNumber INTEGER,
intfStatus INTEGER,
intfDescription DisplayString,
}

Page 20, Tutorial MIB Designer & AgenPro ©2017


Departamento de Informática, Universidade do Minho

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 }

Page 21, Tutorial MIB Designer & AgenPro ©2017

You might also like