Listening for SNMP Traps Action Pack
Introduction
A POC use case demanded a SNMP trap listening solution.
The SNMP listener runs permanently and waits a SNMP Trap and executes a given Automic Workflow for any received SNMP trap. The information delivered by the SNMP Trap are added to PromptSet Object which has to be attached to an Automic Workflow.
The solution consists of two components.
- Java JAR file which listen for SNMP Traps and executes Automic Workflow
- Action Pack for calling the Java solution
Usage Scenarios
- Automatically fixing systems errors which were reported by a SNMP traps.
- Manually driven solution process with approvals triggered by a SNMP Trap. Useful in data Centers. It might also include the Automic Job Request Manager.
Command line Parameters and Action Prompt Fields
Note: All parameters can also be specified in the ‘SNMPTrapEvent4Automic.ini’ configuration file which has to be located in the same directory as the JAR file. The configuration file uses the same name for the parameters but lowercase.
The parameters provided by the command line have higher priority than the parameters from the configuration file.
The parameters can be used without a specific order and the names are not case sensitive.
Parameter / Action Pack Field / Description-Clt= / Automic Client / Automic client to be used.
-Usr= / Automic User name / Automic user name.
-Dep= / Department / Optional parameter with the department of the user
-Pwd= / Automic User Password / Password of the given user – Either encrypted or non-encrypted Passwords are supported. Use the Automic Tool ‘Ucybcryp.exe’ for the password encryption. You find in the online help more details about the password tool.
-Cp= / Hostname Automic System / Automic server name. Hostname or IP-Address are supported. Default=localhost
-CpPort= / Automic CP Port / Port of an Automation Engine Communication Process. Default: 2217
-AutomicObject= / Automic Object to be called / Name of the Automic Object to be executed. The Workflow should include a Prompt Object. See below for more details.
-ListenIP= / SNMP Listen IP / IP address to listen for SNMP traps
-ListenPort= / SNMP Listen Port / Port to be used to listen for SNMP Traps.
Default: 162
-filterEnterprise= / Filter for Enterprise / Optional filter in order to wait for traps with a specific Enterprise id '
-filterspecific= / Filter Trap Specific / Optional filter for traps with the Enterprise ID from above and ‘Specific ID’ which often represents the cause for the error.
-alias= / Object Alias / The name which get displayed in the Process Monitor window instead of the object name.
Following placeholders can be used to display SNMP data in the alias text.
#ENTERPRISE – SNMP enterprise
#SPECIFICTRAP – The Specific from the trap
#GENERICTRAP – The Generic from the trap
The limitation for an Alias term apply here. Check the Automic documentation for more details.
-queuename= / Queue name / Name of the Queue which should run the object
-Comment= / Comment / Optional - The Comment can be used to identify parallel running instances
-ConfigFile= / Optional –Path to the ‘SNMPTrapEvent4Automic.ini’ configuration file.
Path to the listener jar file / Location where the ‘SNMPTrapEvent4Automic.jar’ is located. The path as to be terminated by the path separator. E.g. ‘/tmp/’
Overwrite Agent / Name of Unix or Automic Windows Agent to be used to execute ‘SNMPTrapEvent4Automic.jar’
Overwrite Login / Automic Login Object with the user name with permission to run the SNMP Listener tool.
Note about the permissions to run the SNMP listener
In order to receive SNMP traps it is necessary to bind to a network Port. On UNIX systems it requires the ‘root’ user privilege. By default the Automic UNIX Agent does not allow to execute Job as user ‘root’. You need to add the permission by activating the setting ‘root=START’ in the INI configuration file of the agent.
On Windows it is not recommended to enter the password in the Promptset of the Action. The fact that the SNMP listener binds to a network port makes it necessary to start the Automic Windows job in a way that prints the password in clear text in the Job report. The recommended way is to encrypt the password using password encryption tool and enter the encrypted password in the ‘SNMPTrapEvent4Automic.jar’ and leave the password field in the PromptSet blank. This applies only for Windows.
Structure of the Automic Workflow object executed by the Listener
The SNMP Listener reads following information delivered by the SNMP trap.
The Action Pack already includes a configured PromptSet with the name PKG.PRPT.SNMP.EVNT.CALL.PARAMS which is located in /PACKAGES/PCK.CUSTOM_SNMP_EVENT_LISTENER/TEMPLATES/PROMPSETS
SNMP Trap Data Field / Variable Name defined by the PROMPTSETsecurityName / &PS_SECURITYNAME#
enterprise / &PS_ENTERPRISE#
genericTrap / &PS_GENERICTRAP#
specificTrap / &PS_SPECIFICTRAP#
processed / &PS_PROCESSED#
peerAddress / &PS_PEERADDRESS#
PS_Comment# -> This is provided by ‘Comment’ Command line parameter
This PromptSet has to be attached to the Workflow Object which is designated to be executed by the SNMP Event. You may use the PKG.TEMPLATE.SNMP.EVENT.TARGET.WORKLOW object as template for your Workflows.
Ucybcryp.exe password encryption tool
Ucybcryp.exe is part of the Automation Engine tool set. It is intended to encrypt a password, so it can be used as a command line parameter.
ucybcryp.exe -p -n <Password>
It creates a file which called ‘Password.acc’ which includes the encrypted password.
Installation
No installation necessary but it expects the Automic API library ‘uc4.jar’ and the ‘snmp4j-2.5.7.jar’ library in the lib directory parallel to the SNMPTrapEvent4Automic.jar file. The uc4.jar is part of the Automic Automation Engine and typically located in the ‘ApplicationInterface’ directory.
Note: The uc4.jar should be used from the Automation Engine installation in order die avoid a version mismatch.
1 | Page