Create LAMbots from MIBs

You can use the Mib2lam conversion utility to create trap modules and LAMbots from the SNMP trap definitions in raw MIB files.

The utility takes MIB files and produces trap modules containing all of the traps found in the provided MIB tree. You can deploy these modules into the Trapd LAM and the Trap LAMbot.

See Ingest SNMP Traps for information about SNMP traps, MIBs and trap processing.

Before You Begin

Before you can run the Mib2lam utility, ensure you have met the following requirements:

  • You have downloaded and installed Node.js. See https://nodejs.org/en/download for download options.

  • You have downloaded the Mib2lam .zip utility file. Contact your support representative for the latest version.

  • If you want to replay traps captured using tcpdump, you have installed net-snmp npm.

Install Mib2lam

To install Mib2lam and accompanying trap modules, you need to run the moog_init_lams.sh script in $MOOGSOFT_HOME/bin/utils.

Run either of the following commands to download and extract the latest version of Mib2lam to $MOOGSOFT_HOME:

moog_init_lams.sh -s

or

moog_init_lams.sh --mib2lam

Note that in order to begin using Mib2lam you will need to configure your Trapd LAM to use the moog_trapd_lam.conf file you have just downloaded. You can find the file in $MOOGSOFT_HOME/config/moog_trapd_lam.conf.

Generate a LAMbot with Mib2lam

To generate a trap module and LAMbot using Mib2lam, follow these steps:

  1. Add any required MIBs to the existing base set in the MIBs directory.

  2. Run the Mibparser utility to create a JSON file of parsed MIBs, for example:

    ./mibparser -c unparsed_mibs.json -i <MIBS_directory_filepath>
  3. Run the Mib2lam utility, defining the path of the parsed MIBS and your filename with configuration options. For example:

    ./mib2lam --config /filepath/mib2lam.conf --mibfile
    <MIBS_directory_filepath>/parsed_mibs.json --oid <oid_starting_point> --module <module> --class <class>

    Specify the configuration file using the -c or --config argument and define the JSON file that Mibparser creates using –mibfile. See Mib2lam Command Reference for all available arguments.

  4. If there are any conflicts such as duplicate MIBs, OIDs or duplicate names, remove or rename the duplicates before parsing the MIBs again and running the Mib2lam utility once more. If there are no issues, a new module is created.

  5. Create a directory under $MOOGSOFT_HOME/bots/lambots/trapModules and move the module into it. If necessary, merge the module into any existing generic modules, transferring over any enumerations and trap-specific functions.

  6. Add the module to the MoogTrapdLam.js LAMbot file contained in the Mib2lam .zip file and add lines the following to the global section:

    LamBot.loadModule("trapModules/generic/test.include");
          var generic = new test(botUtil);

    Alternatively, add the following line to the 'modules' section of moog_trapd_lam.confcontained in Mib2lam:

    "trapModules/generic/test.include"

    Also, add the following line to the top of the Trap LAMbot file:

    var generic = new test(botUtil);
  7. Add routing to allow generic traps to be sent to this module. By default, non-enterprise traps are defined and routed as follows:

    var genericTraps=new GenericTraps(botUtil);
        ...
        case "generictrap"  :   genericTraps.processTrap(moogEvent,trapData,trapInfo); break;

Mib2lam Example

To create a module called 'f5', run the Mib2lam utility with the following command:

./mib2lam --config /mib2lam_1vi/config/mib2lam.conf --mibfile /tmp/mibs/controlmib.json --oid f5 --module f5 --class network

When the utility runs successfully, you can expect a response similar to the one shown:

Module Name : f5
OID Start point : .1.3.6.1.4.1.3375.2.4.0.14 
Use generics : true
Infer Severity : true
Related trap similarity : 35%

Varbind definitions :    
- Include definitions : true
- In descriptions : true
- In custom_info : true 

Global class : network
Check for v1 forwarded as v2c : false
Create test traps : true
Mib JSON input file : ../tmp/mibs/controlmib.json 
Module Output file : /usr/share/moogsoft/custom/mib2lam/bin/../tmp/f5.include