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

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.GetTrapFilterActionList(‘uid’,’Array’)

number = lp.GetTrapFilterActionList(‘uid’,’Array’,index);

Description

The lp.GetTrapFilterActionList LUA function retrieves the list of filters attached to a TRAP (UID)

Parameters

uid - A 64 bits value in a character string format that identify the father object in the directory tree

"array" - A name assigned to the array that will collect the returned values

index      Must be equal to 1 to be confom to the LUA ipairs(array) function.

Return Values

number         The number of filters assigned to this Trap uid

Warning  ! The function returns table with ordered index starting at 0. By default in LUA index start at 1. V=Beware of this particularity before using LUA function attached to table broswing.

nil                           If an error occurs       

array[0]… array[number-1]  the UID foudn (or array[1] … array[number] if index)

 

Example

A wizard helps you to find the UID attached to a Trap filter.

Get trap filter action list with lua

Get trap filter action list with lua

number2=lp.GetTrapFilterActionList("4740859784079605760","taa");

 

if number2 then

       lp.Print(string.format("\nFound %i Action registered for this trap filter\n\n",number2));

       for jj=0,(number2-1) do

 

       lp.Print(string.format("\tAck Action UID [%s] \n",taa[jj]));

 

       end

end

 

 

Get trap filter action list with lua

A simple example of a browse

number2=lp.GetTrapFilterActionList("4740859784079605760","ta");

 

if number2 then

lp.Print(string.format("\nFound %i Action registered for this trap filter\n\n",number2));

for jj=0,(number2-1) do

lp.Print(string.format("\tTrap Action UID [%s] \n",ta[jj]));

end

 

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

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

lp.Print(string.format("Trap Action %s\n",ta[i]));

end

 

lp.Print("ipairs\n");

lp.GetTrapFilterActionList("4740859784079605760","ta",1);

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

 

end

Get trap filter action list with lua

 

 


www.loriotpro.com