![]() ![]() |
LoriotPro
scripting documentation |
![]() ![]() ![]() |
![]() |
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
Result=lpav.InsertFilter(condition, value, color, event, threshold,ip, mask, msg, level);
Description
Create a new filter condition and attach it to the default graphical ACtive View object filter list
Parameters
condition - The condition slected among the following condition
dofile(lp.GetPath().."/config/script/loriotinit.lua");
LPAV_FILTER_CONDITION_EGAL =0;
LPAV_FILTER_CONDITION_SUP =1;
LPAV_FILTER_CONDITION_INF =2;
LPAV_FILTER_CONDITION_DIF =3;
LPAV_FILTER_CONDITION_SUP_EGAL =4;
LPAV_FILTER_CONDITION_INF_EGAL =5;
LPAV_FILTER_CONDITION_FIND =6;
LPAV_FILTER_CONDITION_BAD_EXPRESSION =7;
LPAV_FILTER_CONDITION_ANY =8;
color - A RGB color in a 32 bits format (0 = balck) Use our Color picker to find a color
value - A character string to which is compare the expression retrun value according to the condition or (null).
event - The event number that is generated if the condition is satisfied.
Threshold - The number of condition that should be satisfied before that the event is fired.
ip - The IP address used as IP reference in the event
mask - The IP mask of the event IP reference
msg - the message of that describe the event or (null)
level - The level of the event, change the backgournd color and icon in the event mananger log
You should better use the user graphique interface to create set of filters
The syntax is used in the Active View cmp file.
object filter 0 "runnable" 8453888 0 1 0 0 "(null)"
0
object filter 7 "#ERROR" 16744448 0 1 0 4294967295 "Bad expression
for [defip]" 3
object filter 8 "(null)" 255 0 1 0 0 "(null)" 0
Remark
The IP addresses are stored in 32 bits integer format. Conversion should be made when passing them to the function.
lpav.InsertFilter(0, " runnable ",
8453888, 0,1 ,lp.iptoa( 0) ,lp.iptoa(0), "(null)",0);
Return Values
result=1 if ok else return nil
Example
lp_value = 0;
lp_buffer ="error";
dofile(lp.GetPath().."/config/script/loriotinit.lua");
zz=LPAV_OBJ_ANALOGIC_METER_01;
k=0;
for i=0,20 do
lpav.Insert(10*i,1,9,9,zz);
if (k==0) then lpav.SetRef(1,"r"); k=1; else lpav.SetRef(1,"s");
k=0; end
lpav.SetBrush(0,255,0);
lpav.SetFontName("Mistral");
lpav.SetName(i);
lpav.SetClipart( lp.GetPath().."/card/vumeters/vumeter8.emf");
lpav.InsertMenu(LPAV_ACTION_RUN_SCRIPT_LUA,"Select all","D:\v4-net\bin\config\script\SELECT~1.LUA
defip");
lpav.InsertMenu(LPAV_ACTION_RUN_SCRIPT_LUA,"Clear All selected","D:\v4-net\bin\config\script\CLEARA~1.LUA
defip");
lpav.InsertMenu(LPAV_ACTION_RUN_SCRIPT_LUA,"Put internetwork map","D:\v4-net\bin\config\script\new\LPAVIN~2.LUA
defip");
lpav.InsertMenu(LPAV_ACTION_RUN_SCRIPT_LUA,"Unselect G","D:\v4-net\bin\config\script\clean.lua
defip");
lpav.InsertMenu(LPAV_ACTION_RUN_SCRIPT_LUA,"Delete All Selected","D:\v4-net\bin\config\script\DELETE~1.LUA
defip");
--object filter 0 "runnable" 8453888 0 1 0 0 "(null)" 0
--object filter 7 "#ERROR" 16744448 0 1 0 4294967295 "Bad expression
for [defip]" 3
--object filter 8 "(null)" 255 0 1 0 0 "(null)" 0
--LPAV_FILTER_CONDITION_EGAL =0;
--LPAV_FILTER_CONDITION_SUP =1;
--LPAV_FILTER_CONDITION_INF =2;
--LPAV_FILTER_CONDITION_DIF =3;
--LPAV_FILTER_CONDITION_SUP_EGAL =4;
--LPAV_FILTER_CONDITION_INF_EGAL =5;
--LPAV_FILTER_CONDITION_FIND =6;
--LPAV_FILTER_CONDITION_BAD_EXPRESSION =7;
--LPAV_FILTER_CONDITION_ANY =8;
lpav.InsertFilter(LPAV_FILTER_CONDITION_EGAL, "runnable" , 8453888
,0 ,1,lp.iptoa(0),lp.iptoa(0), "(null)", 0);
lpav.InsertFilter(LPAV_FILTER_CONDITION_BAD_EXPRESSION,"#ERROR" ,16744448
,0 ,1, lp.iptoa(0),lp.iptoa(4294967295), "Bad expression for [defip]",3);
lpav.InsertFilter(LPAV_FILTER_CONDITION_ANY,"(null)", 255, 0, 1, 0,
0 ,"(null)", 0);
lpav.SetOption(LPAV_UNIT,"%");
end
lp.Trace("fin");
lpav.RefreshMap();
static const luaL_reg activeviewlib[] = {
{"ClearMultiSelect", lpav_ClearMultiSelect},
{"SetMultiSelect", lpav_SetMultiSelect},
{"IsMultiSelectedMode", lpav_IsMultiSelectedMode},
{"RequestString", lpav_RequestString},
{NULL, NULL}
};
![]() |
|