11 Tools
External tools like a PDF viewer, SNMP tool, or code generator program like AgenPro 2 can be easily integrated with MIB Designer. Choose from the main menu to configure an external program for usage with MIB Designer with the dialog shown on the left.
Figure2-31: Tool Configuration
In the above example, four tools have been configured. Each tool is listed by its title and gets populated in the menu by the same order as displayed in the configuration dialog.
To add a new tool, press the button and the Tool Editor dialog will be displayed where the tool can be defined by the following properties:
A title (required), which is displayed under the menu.
The path of the tool’s executable (required).
An optional list of command line parameters. To allow a closer coupling between MIB Designer and external tool, a set of macros can be used in the parameter field. For an overview about available macros see the table below.
An optional working directory for the external tool.
|
MACRO |
Description |
|
$MODULE_NAME |
This macro will be replaced by the currently edited MIB module name when the tool is executed. |
|
$MODULE_AS_HTML_FILE[=<moduleName>] |
The current module (or the MIB module with the specified name after the optional = sign) is exported as a HTML file into a temporary file. The macro is then replaced by the file name of the temporary file on the tool’s command line. |
|
$MODULE_AS_PDF_FILE[=<moduleName>] |
Same as above, except that the MIB module is exported as a PDF file. |
|
$MODULE_AS_TXT_FILE[=<moduleName>] |
Same as above, except that the MIB module is exported as a plain text file. |
|
$MODULE_AS_XML_FILE[=<moduleName>] |
Same as above, except that the MIB module is exported as a XML file. |
|
$MODULE_AS_XSD_FILE[=<moduleName>] |
Same as above, except that the MIB module is exported as a XML schema file. |
|
$REPOSITORY |
This macro is replaced by the path to the MIB repository of MIB Designer. This macro can be used to run command line versions of MIB Explorer and AgenPro 2. |
|
$SELECTED_OID |
This macro is replaced by the object identifier of the currently selected node in the MIB tree of the edited MIB module. If the node does not have an OID (e.g. a textual convention) then “0.0” is inserted instead. |
Table 1: Macros for the tool configuration.
To remove a tool from the configuration, select the tool in the list and press the button. To change the order of the tools in the run menu, select a tool and press the or button.
The tables that follow provide a few example tool configurations that might be helpful illustrate the capabilities of the tool integration interface.
The PDF viewer tool will use Adobe® Acrobat® to view the currently edited MIB module in its PDF representation.
The SNMP4JCLT Sub-Tree Browser walks the sub-tree specified by the object identifier of the selected node in MIB Designer’s MIB tree by using GETBULK SNMPv2c requests. The target SNMP agent is the localhost on port 161. The community used is “public”. For more information on the command line parameters of SNMP4J see the snmp4jclt_usage.txt file.
On a Windows system, the Dump HOST-RESOURCES-MIB tool dumps the text of the HOST-RESOURCES-MIB into the MIB Designer tool log.
The AGENT++ Stub Generation tool executes AgenPro with the current MIB module name as the code generation project name. Of course, one needs to create and save the project under that name by using the AgenPro GUI before one can successfully run the tool. When MIB Designer and the AgenPro project share the same MIB repository, this tool definition automates the stub generation process.
|
Title |
PDF Viewer |
|
Program |
C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe |
|
Parameters |
$MODULE_AS_PDF_FILE |
|
Working Directory |
|
Table 2: Example configuration for a PDF Viewer.
|
Title |
SNMP4JCLT Sub-Tree Browser |
|
Program |
/usr/bin/java |
|
Parameters |
-jar SNMP4J-CLT.jar –c public -v 2c -L „<License>“ <Key> walk udp:127.0.0.1/161 $SELECTED_OID |
|
Working Directory |
~/snmp4jclt |
Table 3: Example tool configuration for SNMP4JCLT sub-tree browsing. Note: You have to provide your MIB Designer license and key on first execution. The license has to be enclosed in double quotes. For more help run „-jar SNMP4-CLT.jar help“.
|
Title |
Dump HOST-RESOURCES-MIB |
|
Program |
C:\WINDOWS\SYSTEM32\CMD.EXE |
|
Parameters |
/C type $MODULE_AS_TXT_FILE=HOST-RESOURCES-MIB |
|
Working Directory |
|
Table 4: Example tool configuration for dumping a MIB module to the console.
|
Title |
AGENT++ Stub Generation |
|
Program |
/home/agentpp/agenpro2/agenpro.sh |
|
Parameters |
projects/$MODULE_NAME.prj |
|
Working Directory |
/home/agentpp/agenpro2 |
Table 5: Example tool configuration for generating stub code with AgenPro by using a project file named by the current MIB modules name.
To execute a tool, choose it from the sub-menu. If there are no items in the sub-menu, no tools have been defined yet. See section “Tool Configuration” on page 63 for a description on how to configure tools then. The first ten configured tools can be directly run by pressing through and .
Tools are executed synchronously. Thus, MIB Designer will not respond to key and mouse events until the executed tool as been terminated. The output of the last tool run is displayed in the lower right panel where MIB Designer also displays SMI checker error messages. If the executed process (tool) generated any output on stdout, the output will be displayed with blue foreground. If it generated output on stderr, then the output will be displayed with orange foreground.