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.SendTrapV2 - Send a SNMP Trap in V2C format

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.SendTrapV2('ipdest','community','trapname','iod1,oid2');

Description

The lp.SendTrapV2 LUA function sends a SNMP Trap in V2C format to a Trap receiver (UPD port 162).

Refers to RFC 1215

Parameters

‘ipdest’                     The IP address of the remote TRAP serveur ( Any SNMP Manager like LoriotPro).

‘community’            The ‘community’ used to authenticate the TRAP by the SNMP manager. 

‘trapname’               The SNMP TRAP name. 

'iod1,oid2'                 A list of oid and value for each varbind of the TRAP.

The syntax should be : Oidname.index/(type)value

syntax

Value type

(nu)

NUL

(id)

Objet ID

(hs)

Hexa string

(os)

Octet string

(in)

Integer

(ip)

IP adresse

(co)

Counter

(ga)

Gauge

(ti)

Timeticks

Nom SNMPV2

Description

coldstart

Coldstart

warmstart

Warmstart

linkdown

LinkDown

linkup

LinkUp

Authenticationfailure

Authentication Failure

lp.SendTrapV2('127.0.0.1','public','coldstart','sysname/(OS)my pc');

lp.SendTrapV2('127.0.0.1','public','warmstart','ifindex.1');

lp.SendTrapV2('127.0.0.1','public','linkdown','ifindex.1');

lp.SendTrapV2('127.0.0.1','public','linkup','ifindex.1');

lp.SendTrapV2('127.0.0.1','public','Authenticationfailure','ifindex.1');

 

Return Values

value : value equal 1 if trap sent

Return nil if an error occurs

Example

You can use the TRAP simulator service and the Wizards of the editor to help you to create your LUA code.

trap v2c with LUA

trap v2c with LUA

 

lp.SendTrapV2('127.0.0.1','public','coldstart','sysname/(OS)my pc');

lp.SendTrapV2('127.0.0.1','public','warmstart','ifindex.1');

lp.SendTrapV2('127.0.0.1','public','linkdown','ifindex.1');

lp.SendTrapV2('127.0.0.1','public','linkup','ifindex.1');

lp.SendTrapV2('127.0.0.1','public','Authenticationfailure','ifindex.1'); 

lp.SendTrapV2('127.0.0.1','public','dlswtraptconndown','dlswTConnOperTDomain/(IN)145,dlswTConnOperRemoteTAddr/(NU),');

 

Trap should be display in the trap log of LoriotPro.

trap v2c

 

 


www.loriotpro.com