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

GlobalObject LUA function creation

This document explain how to create LUA function that are used by GLOBAL OBJECTS within LoriotPro.

When you edit a global Object you can create and/or modify the LUA function attached to this Global Object.

The LUA editor is launched when in the Global Object editor dialog box, you click on the Edit ScheduleObject Function.

If it is a new Global Object you should see the LUA Editor openning as is:

Empty Editor of LUA function of Global Object

By default you have an empty function that do nothing. Code has to written inside.

Before you get a list of all Global Object variables available inside the function.

The variables are stored in a LUA table. The table name is VAR.

Acessing a variable use the syntax VAR.variable_name

VAR Table (list of variables that are transmitted to the script as arguments) The Global Object Name
VAR.schedule 1 if scheduled locally, 2 if scheduler is external
VAR.string The current value of the String variable of this Global Object
VAR.status The current value of the Status variable of this Global Object
VAR.double The current value of the Double variable of this Global Object
VAR.FunctionName The name of the function
VAR.GroupName The name of the Group of this Global Object
VAR.param1 The first argument received by the LUA funbction
VAR.param2 The second argument received by the LUA function
VAR.lock 1 if locked by one multitasking scheduler 0 if not Accessed
VAR.time the last timestamp
VAR.clock the last clock timestamp
VAR.FunctionExecutionTime The time
VAR.fileok -the function file is ok (1 else 0)
VAR.accessed the number of scheduling from the start
VAR.checkstatus 0 no 1 ip 2 uid
VAR.ipref ip address to check
VAR.uidref uid directory item to check
VAR.refstatus -the status of the unit tested
VAR.interval the time beetwen 2 polling
VAR.intervaltype 0 secondes 1 millisecondes
VAR.istimetorun 1 yes 0 No
VAR.type The check type, 0 no checking, 1 IP Check, 2 UID check


A simple LUA function:

The simple example below will performe a SNMP GET on host Param 1 of a single SNMP object Param 2 an assigns the returned value to the Global Object String value.