Automation Engine Script Guide > Ordered by Function > Error Handling and Messages > :SEND_SNMP_TRAP

:SEND_SNMP_TRAP

Script Statement: Sends an SNMP trap

Syntax

:SEND_SNMP_TRAPTrap Code, Parameter, [Parameter], [Parameter]...

Syntax

Description/Format

Trap Code

Freely-definable code to which SNMP management can react
Format: number, script variable or script function

Parameter

Additional information that can be sent with the SNMP trap
Format: number, script literal, script variable or script function

Use inverted commas for the client number (e.g. "1000")

Comments

This script statement sends an SNMP trap with its specified parameters to a management system. It can only be used if all requirements for SNMP functionality have been implemented.

Up to 10 parameters can be set and sent. From these, a maximum of 5 strings and 5 numbers is allowed. The position of strings and numbers is pre-determined. Strings must come first, then the numbers follow. At least one string must be indicated.

Trap codes generated by AE and HP OpenView Integrator (trap codes: 10000 - 10010) cannot be used.

Examples

The first example shows a simple test. Several parameters are sent to the management system with the SNMP trap 50000.

:SEND_SNMP_TRAP 50000,"Text1","TEXT2","TEXT3","TEXT4","TEXT5",1,2,3,4,5

In the second example, the activation data is determined in a first step. Depending on whether activation is made directly or within a workflow, different traps are sent. Both traps consist of the trap code and a prepared string.

:SET &NAME#     = SYS_ACT_ME_NAME()
:
SET &ID#       = SYS_ACT_ME_NR()
:
SET &JPNAME#   = SYS_ACT_PARENT_NAME()
:
SET &CLIENT#   = SYS_ACT_CLIENT()
!Trap type = Alarm

:
SET &TYPE#     = 4
!Importance of the event

:
SET &SEV#      = 4


:
IF  "&JPNAME#" = ""
:    
SEND_SNMP_TRAP 50001, "&CLIENT#","Error in task &NAME# (&ID#)!",,,,&TYPE#,&SEV#
:
ELSE
:    
SET &JPID# = SYS_ACT_PARENT_NR()
:    
SEND_SNMP_TRAP 50002, "&CLIENT#","Error in workflow &JPNAME# (&JPID#) in the task &NAME# (&ID#m)!",,,,&TYPE#,&SEV#
:
ENDIF

The third example shows how the retrieved activation data is assigned to the script statement in the form of individual parameters. Thus, activation data is available in the management system in individual values which facilitates any further processing.

:SET &NAME#     = SYS_ACT_ME_NAME()
:
SET &ID#       = SYS_ACT_ME_NR()
:
SET &JPNAME#   = SYS_ACT_PARENT_NAME()
:
SET &CLIENT#   = SYS_ACT_CLIENT()
!Trap type = Alarm

:
SET &TYPE#     = 4
!Importance of the event

:
SET &SEV#      = 4



:
IF   &JPNAME# = ""
:    
SEND_SNMP_TRAP 50001,"&CLIENT#","&NAME#",,"Error in the task!",,&TYPE#,&SEV#,&ID#
:
ELSE
:    
SET &JPID = SYS_ACT_PARENT_NR()
:    
SEND_SNMP_TRAP 50002,"&CLIENT#","&NAME#","&JPNAME#","Error in the workflow!",,&TYPE#,&SEV#,&ID#,&JPID#
:
ENDIF

If &ID# and/or &JPID# should be sent as numbers rather than as strings, they can only be assigned after the fifth parameter. Commas must be used in place of unused parameters which are meant for strings.

 

See also:

Script element Description

SYS_SNMP_ACTIVE

Checks if the SNMP connection (Simple Network Management Protocol) of AE if active

Script Elements - Error Handling and Messages

AE and SNMP 

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function