LUALoriotPro WEB site

LoriotPro scripting documentation
Extensions for LUA language

Table of contents Search function

Print the current page Mail this  link UTUBE Channel version française

lp.IsLoadedMIBRef - Check if a MIB file is loaded and accessible

LoriotPro has extended the LUA sripting language by providing its own LUA libraries. The new functions provided are dedicated to the creation of monitoring and SNMP automation application.

Syntax

result = lp.IsLoadedMIBRef("description-mib");

Description

The lp.IsLoadedMIBRef LUA functionj checks that the MIB file with reference « definitions-mib» is loaded in memory. Mib file are loaded in memory if they have been compiled with the LoriotPro MIB compiler.

At each beginning of a MIB file there is a MIB reference name and all subsequent defined MIB objects are linked to this MIB name. It is necessary to check that MIB objects are available before using them.

Example here with RFC1213-MIB

-- RFC1213 MIB
-- groups in MIB-II
RFC1213-MIB DEFINITIONS ::= BEGIN
system OBJECT IDENTIFIER ::= { mib-2 1 }
interfaces OBJECT IDENTIFIER ::= { mib-2 2 }
at OBJECT IDENTIFIER ::= { mib-2 3 }
ip OBJECT IDENTIFIER ::= { mib-2 4 }
icmp OBJECT IDENTIFIER ::= { mib-2 5 }
tcp OBJECT IDENTIFIER ::= { mib-2 6 }
udp OBJECT IDENTIFIER ::= { mib-2 7 }
egp OBJECT IDENTIFIER ::= { mib-2 8 }
-- historical (some say hysterical)
-- cmot OBJECT IDENTIFIER ::= { mib-2 9 }
transmission OBJECT IDENTIFIER ::= { mib-2 10 }
snmp OBJECT IDENTIFIER ::= { mib-2 11 }

The funtion lp.IsLoadedRef do not perform a search on MIB file name but on MIB reference name. The LoriotPro MIB tree can show you the MIB reference name in extended view mode. The MIB compiler can also show you the MIB reference name.

Parameters

definitions-mib - the MIB reference name or description name

Return Values

Result = 1 if the MIB is loaded

nil if an error occurs

Example

 

result = lp.IsLoadedMIBRef("RFC1213-MIB");

if result then

lp.Print("RFC1213-MIB loaded\n");

else

lp.Print("RFC1213-MIB no loaded\n");

end

 

is loaded mib

 



www.loriotpro.com