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.GetAllHostFromContainer

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

number = lp.GetAllHostFromContainer('uid','array')

number = lp.GetAllHostFromContainer('uid','array',index)

Description

The GetAllHostFromContainer retrieves all the UID of directory object that are inside a container (directory branch)

Parameters

‘uid’               The UID of a container. If the UID equal ‘world’ then the complete list of host will be retruned. The script editor provide a Wizard allowing you to find and select the UID of a container. 

‘array’           A table with all the IP adresses of the found hosts loacted in the selected container.

index             Equal to 1 if the table start at 1, require to support the LUA ipairs(array) function.

Return Values

Number         The number of entries in the table 'array’

Warning ! . LoriotPro LUA function returns indexed table starting at index 0. Usually LUA function returns table starting at index 1. This cas cause errors when using some management function of LUA.

array[0]…array[number-1]             An array of the IP adresses of the devices found. (or array[1]…array[number] if index)

nil                            nil if an error occurs

Example

The following example retrieve a table of the world container

lp.Print("start\n");

a=lp.GetAllHostFromContainer("word","array");

if (a~=nil) then

lp.Print("number :",a,"\n");

for i=0,a-1 do

lp.Print(string.format("ip = %s \n",array[i]));

end

lp.Print("table.getn\n");

for i=0,table.getn(array) do

lp.Print(string.format("ip = %s \n",array[i]));

end

 

a=lp.GetAllHostFromContainer("word","array",1);

if (a~=nil) then

 

lp.Print("ipairs\n");

for key,value in ipairs(array) do lp.Print("[",key,"] [",value,"]\n") end

end

end

Get All Host From Container

You can use the WIzard to select the UID of the container.

Get All Host From Container

Get All Host From Container

The container ‘Local_Network_192.168.44.0’ doesn't contain any host.

Get All Host From Container

 

 


www.loriotpro.com