Skip to main content

MIB Db

The MibDb LAMbot module can be used by the Trapd LAM to translate OIDs (object identifiers) into their defined names, provided the OIDs have been defined in the MIBs (Management Information Bases).

The MibDb module allows the Moogsoft Enterprise Trapd LAMbot to look up the defined name of the provided OID String.

For example, when a trap is passed to the Trapd LAMbot, the varbind keys can be OID Strings, which can be very long and not easy to read. These can be translated to human readable names by using the MibDb module and calling the function translateOID. The result may be used for debug logging or inserted into an Event for future use.

The translateOID method performs an ordered look up on two internal databases, returning the first possible match. The first is a V2 Notification and general MIB Objects database, and the second is the V1 Trap database. This ordering can cause issues if you have a V1 Trap and a V2 MIB Object with the same OID and a different name

If looking up a V1 Trap, the method translateV1TrapOID should be used instead (see below)

The MibDb module is only available to load into the Trapd LAMbot.

To use, at the top of the TrapdLam.js file, define a new global object mibDb to the MibDb module:

var mibDb = LamBot.loadModule("MibDb");

Methods

Reference Guide

The oidAsString argument used in the MibDb module is a single string.

Multiple arguments are possible using concatenation. See examples below.

mibDb.translateOID(oidAsString)

Translate an OID String into a human readable String by looking up the OID in the resolved MIBs used by the Trapd LAM.

Request Argument

Name

Type

Description

oidAsString

String

A single string of valid JavaScript variables or objects, used to form a valid absolute OID.

Return Parameter

Name

Type

Description

resolvedName

String

The fully or partially resolved name, if found. Otherwise null is returned.

The following examples are based on default base MIBs that are shipped with Moogsoft Enterprise.

Example 1

var resolvedName = mibDb.translateOID("1.3.6.1.4.1.8072");

The output of resolvedName is:

netSnmp

Example 2

The oidAsString parameter can be created using concatenations. In this example, a variable is used to provide a base OID:

var parent = "1.3.6.1.4.1.8072"
var partiallyResolvedName = mibDb.translateOID(parent + ".11");

The output of partiallyResolvedName is:

netSnmp.11

Example 3

The oidAsString parameter can be provided with a preceding dot but must be a full OID:

var oid1 = mibDb.translateOID(".1.3.6.1.4.1.8074");

The output of oid1 is:

enterprises.8074

mibDb.translateV1TrapOID(oidAsString, (optional) allowPartialMatch)

Translate an OID String into a human readable String by looking up the OID in the resolved V1 Trap database used by the Trapd LAM.

Request Arguments

Name

Type

Description

oidAsString

String

A single string of valid JavaScript variables or objects, used to form a valid absolute OID

allowPartialMatch

Boolean

Optional.

true = returns partial matches if a full match cannot be found

false = returns null if a full match cannot be found

The default is true if not specified

Return Parameter

Name

Type

Description

resolvedName

String

The fully resolved name, partial match or null depending on the allowPartialMatch flag (see above)

The following examples are based on default base MIBs that are shipped with Moogsoft Enterprise.

Example 1

This example asks for a v1 Trap OID to be resolved without allowing partial results:

var trap1 = mibDb.translateV1TrapOID("1.3.6.1.2.1.11.9999.0", false);

This translates correctly to:

coldStart

Example 2

This example asks for a v1 Trap OID to be resolved, without allowing partial results:

var trap2 = mibDb.translateV1TrapOID("1.3.6.1.2.1.11.9999.0.1", false);

Because 1.3.4.1.2.1.11.9999.0.1 has been defined explicitly, this translates to:

null

Example 3

This example asks for a v1 Trap OID to be resolved allowing partial results:

var trap3 = mibDb.translateV1TrapOID("1.3.6.1.2.1.11.9999.0.1", true);

1.3.6.1.2.1.11.9999.0.1 is not explicitly defined, but 1.3.6.1.2.1.11.9999.0 translates to coldStart. Therefore the partial translation is coldStart.1, and this translates correctly to:

Example 4

The oidAsString parameter can be created using concatenations. In this example, a variable is used to provide a base OID:

var parentTrap = "1.3.6.1.2.1.11"
var trap4 = mibDb.translateV1TrapOID(parentTrap + ".9999.1", true);

This translates to:

warmStart

Example 5

If the allowPartialMatching flag is not provided, true is used by default:

var trap5 = mibDb.translateV1TrapOID(".1.3.6.1.2.1.11.9999.1.1");

In this example .1.3.6.1.2.1.11.9999.1 translates to warmStart, and the result is the partial translation:

warmStart.1