Using the mib2map CLI utility

This topic explains the concept of compiling MIB files using the mib2map CLI utility. This topic also provides instructions for compiling the MIB files using the utility.

The mib2map CLI utility is bundled with cell component (server and remote) and is located in the following directory:

  • (Microsoft Windows) <TrueSight Infrastructure Management Install Directory>\pw\server\bin

  • (Linux) <TrueSight Infrastructure Management Install Directory>/pw/server/bin

Before you begin

  • Ensure that the following components are installed on the host computer on which you plan to run the mib2map command:
  • You may have to edit the MIB files to avoid syntax errors while compiling. For details, see Troubleshooting MIB compilation errors.
  • Ensure that all the dependent MIB files are present in the same directory as the main input MIB file. For example, if mib A imports from mib B, then place mib B in the same directory as mib A.

To compile MIB files

  1. Copy the out-of-the-box (net-snmp reference MIBs) and vendor MIB files to a temporary directory. 

    If you have already compiled some MIB files, and currently plan to compile additional MIBs, ensure that you copy the previous MIBs and the current MIBs in the same directory, and compile all of them to get a consolidated output files: mcsnmptrapdmib.baroc, mcsnmptrapdmibe.baroc, mcsnmptrapdmib.dat, mcsnmptrapdmib.map

  2. Go to the <TrueSight Infrastructure Management Install Directory>\pw\server\bin directory, and run the mib2map command to compile the MIB files as shown in the following example:

    #Syntax - Microsoft Windows
    #Separate the MIB file locations using a semicolon.
    perl mib2map.pl -s <Path to snmptranslate.exe> -m ALL -M "<path to net-snmp MIBs>;<path to your MIB directory>"  
    
    #Example
    perl mib2map.pl -s "C:\usr\bin\snmptranslate.exe" -m ALL -M "D:\tmp\vendormibs;C:\usr\share\snmp\mibs" > mib2map.out 2>&1
    
    #Syntax - Linux
    #Separate the MIB file locations using a colon.
    mib2map.pl -s <Path to snmptranslate> -m ALL -M "<path to net-snmp MIBs>:<path to your MIB directory>"
    
    #TBD Linux example
    perl /opt/bmc/TSIMAgent/pw/server/bin/mib2map.pl -s /usr/bin/snmptranslate -m ALL -M /usr/share/snmp/mibs:/opt/sacm/netscout


    Notes

    • The mib2map utility is present in the following directory:
      • (Microsoft Windows): <TrueSight Infrastructure Management Install Directory>\pw\server\bin
      • (Unix): <TrueSight Infrastructure Management Install Directory>/pw/server/bin
    • In the above example, the snmptranslate.exe file is present in the C:\usr\bin directory as the Net-SNMP library is installed in the C:\usr directory. If the Net-SNMP library is installed in any other location, change the path accordingly.
    • If you are running the command on:
      • Microsoft Windows operating system: Separate the MIB file locations using a semicolon.
      • UNIX operating system: Separate the MIB file locations using a colon.
    • To check and resolve some common MIB compilation errors, see Troubleshooting MIB compilation errors.
  3. If the mib2map command runs successfully, it creates the following output files in the <TrueSight Infrastructure Management Install Directory>\pw\server\bin directory.
    • mcsnmptrapdmib.baroc: This file contains the BAROC class definitions of the SNMP Traps found.
    • mcsnmptrapdmibe.baroc: This file contains the BAROC enumerations of the MIB enumerated variables that are sent by traps.
    • mcsnmptrapdmib.dat: This file contains information about object identifiers (OIDs), symbolic names, enumerations and indexes found in MIB traps.
    • mcsnmptrapdmib.map: The adapter uses this mapping file to convert traps into events in the BAROC format.  

    Important Information

    Naming convention for the output files:

    • In the mcxa.conf file, if you have not specified the file names for the MapFile and SnmpDatFile parameters, by default the following file names are used:
      • mcsnmptrapd.dat
      • mcsnmptrapd.map
      This topic uses the default file names in the examples explained.
    • If you want to change these file names, you must set the MapFile and SnmpDatFile parameters in the mcxa.conf file before you run the mib2map command.

    Log message details:

    You can also ensure that the MIB files are compiled successfully by checking the log messages in the mib2map.out file. An example of the successful output message is shown below: 


    BMC Impact Mib2Map 1.1 (build: May 26th, 2003) 
    c) Copyright 2005 BMC Software, All Rights Reserved
    Getting the list of OIDs
    Getting the details of all OIDs (can take some time)
    Creating BAROC (classes and enumerations), map and dat files
    Program terminated

    MIB compilation errors

    If the MIB compilation is unsuccessful, the output messages will indicate the issue with details. To check some common MIB compilation errors, see Troubleshooting MIB compilation errors. After you correct these compilation errors, go back to Step 2 and run the mib2map command.

  4. Take a backup of the existing mcsnmptrapdmib.baroc and mcsnmptrapdmibe.baroc files in the kb\classes directory. Replace the newly created output baroc files into the kb\classes directory. 
  5. Go to the <TrueSight Infrastructure Management Install Directory>\pw\server\etc\CellName\kb\classes directory, open the .load file and update the following file entries in the sequence as shown in the following example: 

    mcsnmptrapdmibe
    mcsnmptrapdmib

    Note: Ensure that the .load file does not have the duplicate entries of these baroc files.

  6. Rename the mcsnmptrapdmib.dat and mcsnmptrapdmib.map files to mcsnmptrapd.dat and mcsnmptrapd.map respectively, and copy the renamed files to the <TrueSight Infrastructure Management Install Directory>\pw\server\etc directory.

    Ensure to copy the existing .map and .dat files into the <TrueSight Infrastructure Management Install Directory>\pw\server\bin directory, if you want to compile additional MIB files and merge the newly compiled MIB definitions into the existing .map and .dat files.

  7. Compile the KB. For details, see mccomp.
  8. Restart the cell and Event Adapter. For details, see Starting and stopping the BMC Event Adapters.

To edit the MAP file

Do the following to manually edit the map file:

  1. Go to the <TrueSight Infrastructure Management Install Directory>\pw\server\etc directory.
  2. Before editing, take a back up of the mcsnmptrapd.map file.
  3. Open the mcsnmptrapd.map file using a text editor.
  4. You can add, edit, or remove the variables in the mcsnmptrapd.map file. The following section lists a few of the variables and an example class file: 
    • msg
    • mc_tool_class
    • mc_tool
    • mc_host_address
    • mc_location
    • severity
      The values for this variable are UNKNOWN, OK, INFO, WARNING, MINOR, MAJOR, CRITICAL, and DOWN.
    • mc_priority
      The values for this variable are PRIORITY_5, PRIORITY_4, PRIORITY_3, PRIORITY_2, and PRIORITY_1.
    • mc_notes
     Sample class file

    CLASS SNMP_ENTERPRISE

          $TrapType equals 6

          ##########################################################################

          #

          # Do not delete the following comment. It is used as a tag by the mib2map

          # utility to include mappings resulting from a MIB parsing.

          #

          ##########################################################################

          # <HERE_INCLUDE_MIB2MAP_RESULTS>

          CLASS SNMP_peNotifications

             $TrapOID equals /^1\.3\.6\.1\.4\.1\.1031\.0/

          # ------------------------------------------------------------------------

          #

          # 1.3.6.1.4.1.1031.5.0.1

          # peParameterStateChange NOTIFICATION-TYPE

          #   -- FROM       BMCPATROLEXPRESS-MIB

          #   OBJECTS       { peAccountName, peElementName, peApplicationName, peApplicationInstanceName, peParameterName, peParameterValue, peParameterState, peParameterTime, peServiceName }

          #   DESCRIPTION   "Parameter state change notification."

          # ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) bmc(1031) peMIB(5) peNotifications(0) 1 }

          #

          # ------------------------------------------------------------------------

             CLASS SNMP_peParameterStateChange

                $TrapOID equals /^1\.3\.6\.1\.4\.1\.1031\.0\.1/

                snmpv_peAccountName = GetListElem ($var, 0)

                snmpv_peServiceName = GetListElem ($var, 1)

                snmpv_peElementName = GetListElem ($var, 2)

                snmpv_peApplicationName = GetListElem ($var, 3)

                snmpv_peApplicationInstanceName = GetListElem ($var, 4)

                snmpv_peParameterName = GetListElem ($var, 5)

                snmpv_peParameterValue = GetListElem ($var, 6)

                snmpv_peParameterState = GetListElem ($var, 7)

                snmpv_peParameterTime = GetListElem ($var, 8) 

             END

          END

       END

  5. Compile the KB. For details, see mccomp.
  6. Restart the cell and Event Adapter. For details, see Starting and stopping the BMC Event Adapters.
Was this page helpful? Yes No Submitting... Thank you

Comments