Moogsoft Docs

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.

Warning

The Mib2lam utility is not included as part of the Moogsoft AIOps distribution. To receive the latest version, contact Moogsoft support.

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 set up an environment for executing the Mib2lam utility, follow these steps:

  1. Create a folder in your Moogsoft AIOps environment and copy the Mib2lam .zip file into it.

  2. Unzip the file:

    unzip mib2lam_150618.zip

After you have extracted the .zip, you can run the Mib2lam utility.

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:

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

    ./mib2lam --config </filepath/filepath/mib2lam.conf> --mibfile
    </filepath/filepath/mib_name.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