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

Predefined virtual SNMP objects

To skip the step of defining a virtual snmp object definition in a MIB file, some generic script objects are already defined in a generic lp_script-standard.mib file. You can use these snmp virtual objects and attach to them the scripts that you frequently use. This generic MIB is called LUTEUS-SCRIPT-STANDARD-MIB.

The MIB LUTEUS-SCRIPT-STANDARD-MIB is available in the /mib directory and need to be compiled before using it. When the compilation is finished you have access to 40 virtual snmp objects under the luteus.scripts object.

script virtual snmp objects in mib tree

If you want to use the snmp vritual object lp_script1, you create a script lp_script1.lua in the /bin/config/script.

script example

In our example we do not pass the index as a parameters, the index is directly enter in the script code.

deafult lua snmp scripts

By default snmp virtual objects are 32 bits integers, if you want you can also define snmp virtual objects that return a character string .

The following object is an example of object that return a character string.

lp_your_string OBJECT-TYPE

SYNTAX OCTETSTRING
ACCESS lp_access_script
STATUS current
DESCRIPTION "return a string"

<LP_SCRIPT>
    lp_buffer ="BAD"
    lp_value, lp_buffer =lp.Get(lp_host,"sysname.0")
<LP_SCRIPT>

::= { your_script 2 }

After compilation the lp_your_string.lua file is created in the bin/config/script directory.

snmp script get sysname

 

script snmp get sysname

The snmp virtual object is available and in the example below return a character string.

snmp virtaule object

Warning : You cannot add a MIB file to the current LoriotPro MIB database if this one is already in the database (the script MIB file has been already compiled). If you want to modify a MIB and update the current MIB database of LoriotPro you need to access the compiler tool and do a Reset to default in the compiler menu. You can restart LoriotPro and recompile all you mib including the new script MIB.

mib compiler

Answer YES to the next question, this wil clean the database to default


Warning; If you do modifications on a script that is currently uses as a virtual snmp object by LoriotPro program or LoriotPro plugin the results are unpredictable.



www.loriotpro.com