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

lpav.GetInformation - Get information on a graphical object

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.GetInformation(array);

Description

Read the global parameters of an Active View object and store the results in an array

Parameters

array - The array name.

Return Values

result = 1 if the array is filled or nil if error.

Array description

array['UID']

uid - The UID of the Active Viewgraphical object as a character string.

array['name']
The graphical object name
array['fontname'] The font name linked to this object
array[‘y’] The Y position of the object, the number of pixel from the top border of the Active View display area
array['x'] The X position of the object, the number of pixel from the right border of the Active View display area
array['x1'] The width of the object in pixel
array['y1'] The hight of the object in pixel
array['polling'] Value 1 if the object is active (polling)
array['polling_interval'] The object polling time interval.
array['lastpolling'] The time stamp of the last polling
array['lastpollingresp'] The time stamp of the last polling response
array['result'] The last polling result
array['expression'] The polling expression attached to this graphical object
array['clipartname'] The clipart file name linked to this object
array['linewidth'] The width of a line object
array['objtype'] The object type (see the file loriotinit.lua)
array['maptype'] The map type linked to this object
array['ref1'] The first reference variable for this graphical object
array['ref2'] The second reference variable for this graphical object
array['ref3'] The third reference variable for this graphical object
array['ref4'] The fourth reference variable for this graphical object

Exemple

lp_value = 0;
lp_buffer ="error";

dofile(lp.GetPath().."/config/script/loriotinit.lua");

lpav.Load(lp.GetPath().."/config/active-view/sample/cisco3500.cmp");


function displayobjectInformation (co)

if lpav.GetInformation("a") then
lp.Trace("name>"..a.name);
lp.Trace("Object Type ------------------------------>");
if a.objtype==LPAV_OBJ_WORLD then lp.Trace("directory world (emf)")
elseif a.objtype==LPAV_OBJ_COUNTRY then lp.Trace("directory country (emf)")
elseif a.objtype==LPAV_OBJ_ORGANIZATION then lp.Trace("directory organization (emf)")
elseif a.objtype==LPAV_OBJ_ORGANIZATION_UNIT then lp.Trace("directory organization unit (emf)")
elseif a.objtype==LPAV_OBJ_NETWORK then lp.Trace("directory network (emf)")
elseif a.objtype==LPAV_OBJ_HOST_1 then lp.Trace("directory host 1 (emf)")
elseif a.objtype==LPAV_OBJ_ROUTER then lp.Trace("directory router (emf)")
elseif a.objtype==LPAV_OBJ_SHORTCUT_1 then lp.Trace("directory shortcut 1(emf)")
elseif a.objtype==LPAV_OBJ_SHORTCUT_2 then lp.Trace("directory shortcut 2(emf)")
elseif a.objtype==LPAV_OBJ_MRTG then lp.Trace("directory mrtg (emf)")
elseif a.objtype==LPAV_OBJ_PLUGIN then lp.Trace("directory plugin (emf)")
elseif a.objtype==LPAV_OBJ_BADPLUGIN then lp.Trace("directory badplugin (emf)")
elseif a.objtype==LPAV_OBJ_LORIOTPRO then lp.Trace("directory Loriotpro (emf)")
elseif a.objtype==LPAV_OBJ_HOST_2_ROUTER then lp.Trace("directory host 2 router (emf)")
elseif a.objtype==LPAV_OBJ_HOST_3_SWITCH then lp.Trace("directory host 3 switch (emf)")
elseif a.objtype==LPAV_OBJ_HOST_4 then lp.Trace("directory host 4 (emf)")
elseif a.objtype==LPAV_OBJ_HOST_5 then lp.Trace("directory host 5 (emf)")
elseif a.objtype==LPAV_OBJ_HOST_6 then lp.Trace("directory host 6 (emf)")
elseif a.objtype==LPAV_OBJ_VIEWPLUGIN then lp.Trace("directory viewplugin (emf)")
elseif a.objtype==LPAV_OBJ_HOST_SERVER then lp.Trace("directory host server (emf)")
elseif a.objtype==LPAV_OBJ_HOST_IMPRIMANTE then lp.Trace("directory host imprimante (emf)")
elseif a.objtype==LPAV_OBJ_HOST_PHONE then lp.Trace("directory host phone (emf)")
elseif a.objtype==LPAV_OBJ_RECT then lp.Trace("rectangle")
elseif a.objtype==LPAV_OBJ_CIRCLE then lp.Trace("circle")
elseif a.objtype==LPAV_OBJ_FILL_RECT then lp.Trace("fillrectangle")
elseif a.objtype==LPAV_OBJ_FILL_CIRCLE then lp.Trace("fill circle")
elseif a.objtype==LPAV_OBJ_H_LINE then lp.Trace("h line")
elseif a.objtype==LPAV_OBJ_V_LINE then lp.Trace("v line")
elseif a.objtype==LPAV_OBJ_DIR_EMF then lp.Trace("directory object (emf)")
elseif a.objtype==LPAV_OBJ_TEXT then lp.Trace("texte")
elseif a.objtype==LPAV_OBJ_FILL_TEXT then lp.Trace("fill texte")
elseif a.objtype==LPAV_OBJ_FULL_RECT then lp.Trace("full rectangle")
elseif a.objtype==LPAV_OBJ_FULL_CIRCLE then lp.Trace("full circle")
elseif a.objtype==LPAV_OBJ_H45_LINE then lp.Trace("H line 45")
elseif a.objtype==LPAV_OBJ_V45_LINE then lp.Trace("V line 45")
elseif a.objtype==LPAV_OBJ_FULL_TEXT then lp.Trace("full texte")
elseif a.objtype==LPAV_OBJ_BASIC_SHAPE then lp.Trace("basic shape (emf)")
elseif a.objtype==LPAV_OBJ_ANALOGIC_METER_01 then lp.Trace("analogic meter (emf)")
elseif a.objtype==LPAV_OBJ_HOST_HUB then lp.Trace("host hub")
elseif a.objtype==LPAV_OBJ_CONNECTOR then lp.Trace("connector")
end
lp.Trace("fontname>"..a.fontname);
lp.Trace("x>"..a.x);
lp.Trace("y>"..a.y);
lp.Trace("x1>"..a.x1);
lp.Trace("y1>"..a.y1);
lp.Trace("polling_interval>"..a.polling_interval);
lp.Trace("lastpolling>"..a.lastpolling);
lp.Trace("lastpollingresp>"..a.lastpollingresp);
lp.Trace("polling>"..a.polling);
lp.Trace("result>"..a.result);
lp.Trace("clipartname>"..a.clipartname);
lp.Trace("linewidth>"..a.linewidth);
lp.Trace("objtype>"..a.objtype);
lp.Trace("maptype>"..a.maptype);
lp.Trace("ref1>"..a.ref1);
lp.Trace("ref2>"..a.ref2);
lp.Trace("ref3>"..a.ref3);
lp.Trace("ref4>"..a.ref4);
lp.Trace("UID>"..a.UID);
return 1;
end
return 0;
end

if lpav.SelectFirst() then
co=lpav.SelectFirst();
while co~=nil do
lp.Trace("<<<object>>>");
displayobjectInformation (co);
co=lpav.SelectNext();
end
end

lp.Trace("fin");

 


www.loriotpro.com