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.GetTCPPoll - Perform a tcp polling

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

status (1=ok 0=bad),total_time_ms,rtt_ms,socket_init_ms,dns_time_ms,error_code,error_string,ip=lp.GetTCPPoll('ip',port);

Description

The lp.GetTCPPoll LUA function performs a tcp polling.

Parameters

ip - The IP address of the host to poll

port - The TCP port number

Return Values

status (1=ok 0=bad),

total_time_ms The total time of the request

rtt_ms the Round trip time of the requst

socket_init_ms The time use to initialize the TCP socket

dns_time_ms The total time used to perform the DNS resolution

error_code The rror code retrun par the request

error_string The error description text

ip the IP address

Example

-- Loriotpro V5
-- To run correctly this file is located to bin/config/script

url='www.paris.com';

port=80;
status,total,rtt,socket_init,dns,error_code,error_string,ip=lp.GetTCPPoll(url,port);
lp.Print("TCP Poll : ",url,":",port," ");
lp.Print("IP resolved : ",ip,"\n");
lp.Print("TCP Polling Status : ",status,"\n");
if (status==1) then
lp.Print("dns resolve \t: ",dns,"ms \t(start->dns)\n");
lp.Print("Socket-init \t: ",socket_init,"ms \t(start->dns->socket_init)\n");
lp.Print("rtt \t\t: ",rtt,"ms \t(start->dns->socket_init->connect)\n");
lp.Print("total time \t: ",total,"ms \t(start->dns->socket_init->connect->closesocket)\n");
lp.Print("===============================\n");
lp.Print("TCP 3HandShake only\t: ",total-socket_init,"ms \t(socket_init->connect) \n");
else
lp.Print("total time \t: ",total,"ms\n");
lp.Print("error code \t: ",error_code," (",error_string,")\n");
end

 

Get TCP polling with LUA


www.loriotpro.com