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

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

‘uid’,status = lp.InsertADVTCPPolling('ip', tcp_port, poll_interval, enable, gen_audio, gen_report, event, level, condition, sla, ['title']);

Description

The lp.InsertADVTCPPolling LUA function attaches a new TCP Audit plugin to a host in the directory. If an audit with the same main identification properties already exists then only the new secondary properties are updated.

To discover the TCP audit plugin read the LoriotPro Administrator handbook.

Parameters

Main parameters

‘ip’                    The IP address of the host

tcp_port          The TCPport number to audit

Secondary parameters

Poll_interval     The polling interval of the audit

enable if = 1The audit will be executed at regular interval (polling interval)

            if = 0 disable the polling

gen_audio       if = 1 notify that the audit can generate audio (Text To Speech)

if = 0 notify the audit that it should not generate audio (Text To Speech)

Warning : If the script doesn't support the otpion the setting has no effect.

gen_report       If = 1 notify that the audit can generate reports

if = 0 notify the audit that it should not generate reports

Warning : If the script doesn't support the otpion the setting has no effect.

event      The event number used by the script to generate alerts (0 = no alert)

level        The level of the event sent

condition       The condition used to generate the event.

                                   1 down

                                   2 become down

3 up

4 become up

5 no sent

Warning :      The condition 5 is used to initialise the event and its level. There will be no event sent in that case. The audit can fetch the parameter and assume the sending of the event. It will ne be sent twice in that case.

sla                 If = 1 The collected data are stored in files for further SLA calculation. The data can be used by the SLA rReport Center or by the LUA functions linked to SLA manipulation.

If = 0 There is no data collection

['title']            An optional parameter that set the title of the audit in the directory

Warning :      Warning: This parameter cannot be updated.

‘uid’                 The UID number of the audit as unsigned 64bits coded as a character string.

value              The result of the operation, = 0 if it is a new insert or =1 if the audit already existed and has been updated.

nil                    If an error occurs

Return Values

‘uid’                 The UID number of the audit as unsigned 64bits coded as a character string.

value              The result of the operation, = 0 if it is a new insert or =1 if the audit already existed and has been updated.

nil                    If an error occurs

Example

The example below insert a TCP audit plugin into the directory and monitor the telnet serveur of a remote host.. We use the lp_host variable for the selection of the remote host.

lp.Print("Start\n");

tcp_port=23; 

uid1,ret=lp.InsertADVTCPPolling(lp_host,tcp_port,60,1,1,1,45000,5,1,1);

if uid1 then lp.Print(uid1," insert TCP port 23\n"); end 

if uid1~= nil and ret==1 then

      lp.EnableDirectoryObject(uid1);

      lp.LocateDirectoryUID(uid1);

uid=lp.FoundADVTCPUID(lp_host,tcp_port);

if (uid) then

uidret=lp.UpdateADVTCPPolling(lp_host,tcp_port,80,1,1,1,45000,5,1,1);

if uidret then lp.LocateDirectoryUID(uidret); end

lp.Print(uid,"  ",uid2,"\n");

end

lp.UpdateDirectory();

end

lp.Print("End\n");

TCP audit polling

The plugin has been added to the directory under the selected host.

TCP audit polling

The plugin can be next reviewed with the properties option of the plugin object.

TCP audit polling

TCP audit polling

 

 


www.loriotpro.com