Important

   

This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management. Open link

snmp_trap_send()

Send a PATROL SNMP event trap.

Syntax

snmp_trap_send(host/[port/community],address enterprise traptype
subid uptime,objectid1 type1 value1,...,
[objectidn lengthn typen valuen])

Parameter

Parameter

Definition

host

name of the computer to which the trap is sent For more information, see the /snmp/piV1m_listdescription in the PATROL Agent Reference Manual.

port

Universal Datagram Protocol (UDP) port number to which the trap is sent on host

community

name of the character string used as a community string for SNMP operations on host

address

address of the SNMP agent that sent the trap

enterprise

enterprise object identifier for the SNMP agent

traptype

SNMP trap type as defined in RFC 1213*Valid Values* 
0-5 standard traps 
6 enterprise trap

subid

identifier number for the trap

uptime

number of clock ticks that the SNMP agent has been active A clock tick is hardware-dependent and for Unix systems is typically between 10 and 20 milliseconds.

objectidn

character string SNMP object identifier for the included variable

lengthn

number indicating the length of valuen, if not delimited by \n

typen


character string indicating the objectidn type

*Valid Values*

  • integer
  • string
  • oid
  • null
  • counter
  • gauge
  • timeticks
  • ipaddress

valuen

value of objectidn

Description

The snmp_trap_send() function sends the specified trap to host. The snmp_trap_send() function returns the characters OKif it is successful and the NULL string otherwise . The snmp_trap_send() function also sets the PSL variable errno = 96 (E_PSL_BAD_FUNCTION_PARAMETER), or errno = 100 (E_PSL_SNMP_ERROR) and returns error messages to the system output window when the function fails.

Example

The following is an example of the snmp_trap_send() function:

# Send SNMP trap to host on which PatrolAgent is running (i.e. localhost).
host = get("/hostname");
tport = get("/snmp/trap_port");
arg1 = host."/".tport;
arg2 = host." .1.3.6.1.4.1.1031 6 1 1";
print(snmp_trap_send(arg1,arg2,
".1.3.6.1.4.1.1031.1 string test",
".1.3.6.1.4.1.1031.2 string test 2",
".1.3.6.1.4.1.1031.3 string test 3",
".1.3.6.1.4.1.1031.4 string test 4"));
Was this page helpful? Yes No Submitting... Thank you

Comments