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

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

value = lp.GetTrapFilterActionInformation(‘uid’,’Array’)

Description

The lp.GetTrapFilterActionInformation LUA function retrieves the information of a Trap filter.

Parameters

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

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

Return Values

value : a positif value if data are present.

Return nil if an error occurs

Valeur

Description

Array.ip

 

Thenetwork or IP adrress attached to this filter

Array.mask

 

The mask of the IP address

Array.community

 

The community in the trap received

(* = all)

Array.search_string0

 

A character string with the search condition

Array.search_condition0

 

0 disable

1 match string (with case conformance)

2 match string (without case conformance)

3 match value (with case conformance)

4 match value (without case conformance)

5 value greater than

6 value lower than

7 value different from

8 value equal or greater than

9 value equal or lower than

 

Array.search_string1

idem

Array.search_condition1

idem

Array.search_string2

idem

Array.search_condition2

idem

Array.search_string3

idem

Array.search_condition3

idem

Array.search_string4

idem

Array.search_condition4

idem

Array.search_string5

idem

Array.search_condition5

idem

Array.search_string6

idem

Array.search_condition6

idem

Array.search_string7

idem

Array.search_condition7

idem

Array.search_string8

idem

Array.search_condition8

idem

Array.search_string9

idem

 

idem

Array.search_condition9

idem

Array.action_type

--[[

#define ACTIONTYPE_WINRUN 1

#define ACTIONTYPE_WAVE 2

#define ACTIONTYPE_SMTP 4

#define ACTIONTYPE_MAPI 8

#define ACTIONTYPE_DOSRUN 16

#define ACTIONTYPE_SYSLOG 32

#define ACTIONTYPE_TRAP 64

#define ACTIONTYPE_CUSTOM 65

#define ACTIONTYPE_SEARCH 66

#define ACTIONTYPE_NULL 67

#define ACTIONTYPE_ROUTE_EVENT 68

//v4

#define ACTIONTYPE_EVENT 69

//v5

#define ACTIONTYPE_EVENT_CORRELATOR 70

#define ACTIONTYPE_EVENT_SCRIPTER 71

#define ACTIONTYPE_EVENT_TTS 72

#define ACTIONTYPE_EVENT_SMS 73

#define ACTIONTYPE_EVENT_DELAY 74

#define ACTIONTYPE_EVENT_ACK_DELAYED 75

--]]

 

Array.string

A character string of the action parameters

 

Array.counter

Array.last

Array.first

Array.first_since

Array.number_total

Array.number_ack

Array.number_delete

Array.number_auto_delete

Array.number_since_clear

Array.number_not_displayed

Array.number_displayed

Array.max_display

Array.number_between_action

Array.action_threshold

Array.action_mode

Array.in_time

Array.clock

Array.disable

 

See : lp.GetTrapFilterInformation

 

 

 

Example

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

trap filter information in lua

trap filter information in lua

Example : see also lp.GetTrapFilterActionList

 

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]));

lp.AckTrapFilterAction(taa[jj]);

      if lp.GetTrapFilterActionInformation(taa[jj],"infi") then

      lp.Print(string.format("\tIf this parameter match : \tip \t%s mask \t %s ",infi.ip,infi.mask));

      lp.Print(string.format("\tcommunity \t%s\n",infi.community));

      lp.Print(string.format("\tSearch string value 0 [%s] condition [%i] \n",infi.search_string0,infi.search_condition0));

      lp.Print(string.format("\tSearch string value 1 [%s] condition [%i] \n",infi.search_string1,infi.search_condition1));

      lp.Print(string.format("\tSearch string value 2 [%s] condition [%i] \n",infi.search_string2,infi.search_condition2));

      lp.Print(string.format("\tSearch string value 3 [%s] condition [%i] \n",infi.search_string3,infi.search_condition3));

      lp.Print(string.format("\tSearch string value 4 [%s] condition [%i] \n",infi.search_string4,infi.search_condition4));

      lp.Print(string.format("\tSearch string value 5 [%s] condition [%i] \n",infi.search_string5,infi.search_condition5));

      lp.Print(string.format("\tSearch string value 6 [%s] condition [%i] \n",infi.search_string6,infi.search_condition6));

      lp.Print(string.format("\tSearch string value 7 [%s] condition [%i] \n",infi.search_string7,infi.search_condition7));

      lp.Print(string.format("\tSearch string value 8 [%s] condition [%i] \n",infi.search_string8,infi.search_condition8));

      lp.Print(string.format("\tSearch string value 9 [%s] condition [%i] \n",infi.search_string9,infi.search_condition9));

 

      lp.Print(string.format("\taction_type %d ",infi.action_type));

 

      if infi.action_type==1 then

            lp.Print(" ACTIONTYPE_WINRUN");

      elseif infi.action_type==2 then

            lp.Print(" ACTIONTYPE_WAVE");

      elseif infi.action_type==4 then

            lp.Print(" ACTIONTYPE_SMTP");

      elseif infi.action_type==8 then

            lp.Print(" ACTIONTYPE_MAPI");

      elseif infi.action_type==16 then

            lp.Print(" ACTIONTYPE_DOSRUN");

      elseif infi.action_type==32 then

            lp.Print(" ACTIONTYPE_SYSLOG\n");

      elseif infi.action_type==64 then

            lp.Print(" ACTIONTYPE_TRAP\n");

      elseif infi.action_type==65 then

            lp.Print(" ACTIONTYPE_CUSTOM");

      elseif infi.action_type==66 then

            lp.Print(" ACTIONTYPE_SEARCH");

      elseif infi.action_type==67 then

            lp.Print(" ACTIONTYPE_NULL");

      elseif infi.action_type==68 then

            lp.Print(" ACTIONTYPE_ROUTE_EVENT");

      elseif infi.action_type==69 then

            lp.Print(" ACTIONTYPE_EVENT");

      elseif infi.action_type==70 then

            lp.Print(" ACTIONTYPE_EVENT_CORRELATOR");

      elseif infi.action_type==71 then

            lp.Print(" ACTIONTYPE_EVENT_SCRIPTER");

      elseif infi.action_type==72 then

            lp.Print(" ACTIONTYPE_EVENT_TTS");

       elseif infi.action_type==73 then

            lp.Print(" ACTIONTYPE_EVENT_SMS");

      elseif infi.action_type==74 then

            lp.Print(" ACTIONTYPE_EVENT_DELAY");

       elseif infi.action_type==75 then

            lp.Print(" ACTIONTYPE_EVENT_ACK_DELAYED");

      end

 

 

      lp.Print(string.format("\tstring [%s]\n",infi.string));

 

--[[

#define TRAP_FILTER_VALUE_NONE 0

#define TRAP_FILTER_VALUE_CONTAIN_CASE 1

#define TRAP_FILTER_VALUE_CONTAIN_NOCASE 2

#define TRAP_FILTER_VALUE_EGAL_CASE 3

#define TRAP_FILTER_VALUE_EGAL_NOCASE 4

#define TRAP_FILTER_VALUE_SUP 5

#define TRAP_FILTER_VALUE_INF 6

#define TRAP_FILTER_VALUE_DIF 7

#define TRAP_FILTER_VALUE_SUP_EGAL 8

#define TRAP_FILTER_VALUE_INF_EGAL 9

--]]

 

      lp.Print(string.format("\tcounter %d\n",infi.counter));

 

      lp.Print(string.format("\tlast %d\n",infi.last));

      lp.Print(string.format("\tfirst %d\n",infi.first));

      lp.Print(string.format("\tfirst_since %d\n",infi.first_since));

      lp.Print(string.format("\t number_total %d\n",infi.number_total));

      lp.Print(string.format("\t number_ack %d\n",infi.number_ack));

      lp.Print(string.format("\t number_delete %d\n",infi.number_delete));

      lp.Print(string.format("\t number_auto_delete %d\n",infi.number_auto_delete));

      lp.Print(string.format("\t number_since_clear %d\n",infi.number_since_clear));

      lp.Print(string.format("\t number_not_displayed %d\n",infi.number_not_displayed));

      lp.Print(string.format("\t number_displayed %d\n",infi.number_displayed));

      lp.Print(string.format("\t max_display %d\n",infi.max_display));

      lp.Print(string.format("\t number_between_action %d\n",infi.number_between_action));

      lp.Print(string.format("\t max_action %d\n",infi.max_action));

      lp.Print(string.format("\t max_display %d\n",infi.max_display));

      lp.Print(string.format("\t number_between_action %d\n",infi.number_between_action));

      lp.Print(string.format("\t action_threshold %d\n",infi.action_threshold));

      lp.Print(string.format("\t action_mode %d\n",infi.action_mode));

      lp.Print(string.format("\t in_time %d\n",infi.in_time));

     lp.Print(string.format("\t clock %d\n",infi.clock));

 

  

end

end

end

 

 

trap filter information in lua

 

 


www.loriotpro.com