AppDynamics SNMP Trap Alerting Integration
##Use Case
Simple Network Management Protocol (SNMP) is a protocol for managing IP network devices such as routers, switches, servers, workstations, etc. An SNMP trap is an asynchronous notification between an SNMP agent to its SNMP manager.
With the SNMP Trap integration you can leverage your existing alerting infrastructure to notify your operations team to resolve performance degradation issues.
This tool sends SNMP trap alerts when triggered via an AppDynamics 3.6/3.7 policy violation and can be configured as a custom action (see Installation).
##Installation
-
Download the SNMPTrapAlertingExtension zip from AppDynamics Exchange
-
Unzip the SNMPTrapAlertingExtension.zip file into <CONTROLLER_HOME_DIR>/custom/actions/ . You should have <CONTROLLER_HOME_DIR>/custom/actions/SNMPTrapAlertingExtension created.
-
Check if you have custom.xml file in <CONTROLLER_HOME_DIR>/custom/actions/ directory. If yes, add the following xml to the element.
``` <action> <type>SNMPTrapAlertingExtension</type> <!-- For Linux/Unix *.sh --> <executable>snmpTrapSender.sh</executable> <!-- For windows *.bat --> <!--<executable>snmpTrapSender.bat</executable>--> </action> ```
If you don't have custom.xml already, create one with the below xml content.
<custom-actions> <action> <type>SNMPTrapAlertingExtension</type> <!-- For Linux/Unix *.sh --> <executable>snmpTrapSender.sh</executable> <!-- For windows *.bat --> <!--<executable>snmpTrapSender.bat</executable>--> </action> </custom-actions>
Uncomment the appropriate executable tag based on windows or linux/unix machine.
-
cd into /custom/conf/SNMPTrapAlertingExtension and edit the config.xml configuration file.
###Parameters
SNMP Parameters Description host Host of the destination where the trap is being sent port Port of the destination where the trap is being sent trap-host IP address of the source that is sending the trap community Community type of the SNMP trap. Default = PUBLIC
enable-logs Enables logging for debugging purposes snmp-version Trap version. (Supports v1, v2 and v3 traps)
####Trap Version 3 specific parameters
SNMP Parameters Description security-level NoAuthNoPriv = 1
AuthNoPriv = 2
AuthPriv = 3
If necessary, see information on security levels.username Username to validate trap password Password to validate trap. Required for security-level greater than 1 auth-protocol Authentication Protocol (MD5 or SHA). Required for security-level greater than 1 priv-protocol Privacy Protocol. Required for security-level = 3 (AuthPriv)
Supports:
- AES256
- AES192
- AES128
- 3DES
- DES
priv-protocol-password Privacy protocol password. Required for security-level = 3 (AuthPriv) ###Example:
<snmp-trap> <host>localhost</host> <port>9000</port> <community>PUBLIC</community> <trap-host>172.16.0.0</trap-host> <enable-logs>true</enable-logs> <snmp-version>3</snmp-version> <!--Only requred if version set to 3.--> <v3> <security-level>2</security-level> <username>username</username> <password>password</password> <auth-protocol>SHA</auth-protocol> <priv-protocol>DES</priv-protocol> <priv-protocol-password>password</priv-protocol-password> </v3> </snmp-trap>
-
Now you are ready to use this extension as a custom action. In the AppDynamics UI, go to 'Alert & Respond' -> 'Actions'. Click on the 'Create Action' button. Select 'Custom Action' and click OK. In the drop-down menu you can find the action called 'SNMPTrapAlertingExtension'.
-
Use the MIB file <CONTROLLER_HOME_DIR>/custom/actions/SNMPTrapAlertingExtension/conf/APPD-CTLR-MIB.mib to interpret the trap at the trap receiver.
##Debugging
To debug the code:
-
Modify the config file and enable logs.
<enable-logs>true</enable-logs>
-
Open <custom_action_directory>/logs/snmpTrapSender.log
##Testing
If you'd like to send a test trap for Debug purpose please use the sendSampleTrap.sh script. This Script will send a simple Trap using the Action Configuration. You can use this to verify that the transmission works and the Trap would be received without the need of producing a real error or event.
##Using the jar file as a standalone
The jar file can be used as a standalone. For information enter "--help" when running the jar:
```
For Windows,
..\..\..\jdk\bin\java -Dlog4j.configuration=file:conf\log4j.xml -DSNMP_TRAP_SENDER_HOME=. -jar .\lib\SNMPTrapSender.jar --help
For Linux/Unix,
../../../jdk/bin/java -Dlog4j.configuration=file:conf/log4j.xml -DSNMP_TRAP_SENDER_HOME=. -jar ./lib/SNMPTrapSender.jar --help
```
##Contributing
Always feel free to fork and contribute any changes directly via GitHub.
##Community
Find out more in the AppSphere community.
##Support
For any questions or feature request, please contact AppDynamics Center of Excellence.