AppDynamics Integration Guide

AppDynamics provides application and database performance management, monitoring, and analytic tools to help you identify and resolve performance issues, drive business outcomes, increase user engagement, and deliver amazing web user experiences. AppDynamics allows you to create notifications based on custom thresholds that can trigger incidents in PagerDuty.

In PagerDuty

  1. Go to the Configuration menu and select Services.

  2. On the Services page:

    • If you are creating a new service for your integration, click Add New Service.

    • If you are adding your integration to an existing service, click the name of the service you want to add the integration to. Then click the Integrations tab and click the New Integration button.

  3. Select your app from the Integration Type menu and enter an Integration Name.

    If you are creating a new service for your integration, in General Settings, enter a Name for your new service. Then, in Incident Settings, specify the Escalation Policy, Notification Urgency, and Incident Behavior for your new service.

  4. Click the Add Service or Add Integration button to save your new integration. You will be redirected to the Integrations page for your service.

  5. Copy the Integration Key for your new integration.

In AppDynamics

  1. Go to the Alert & Respond tab, then click HTTP Request Templates on the left menu and add a new template by clicking New.

  2. Give the template a Name (like “PagerDuty Integration API”) and add two Custom Templating Variables:

    • pd_event_type which you should set to trigger.
    • pd_integration_key which should be set to the Integration Key you copied in step 3 earlier.

  3. In the Request URL section, change Method to POST and set Raw URL to: https://events.pagerduty.com/generic/2010-04-15/create_event.json

  4. In the Payload section, set the MIME Type to application/json, then copy and paste the following in to the text area:

    {    
          "service_key": "${pd_integration_key}",
          "incident_key": "${latestEvent.node.name} - ${latestEvent.application.name}",
          "event_type": "${pd_event_type}",
          "description": "${latestEvent.displayName} on ${latestEvent.node.name}",
          "client": "AppDynamics",
          "client_url": "${controllerUrl}",
          "details": {
            "Event Name": "${latestEvent.displayName}",
            "Summary": "${latestEvent.summaryMessage}",
            "Event ID": ${latestEvent.id},
            "GUID": "${latestEvent.guid}",
            "Event Time": "${latestEvent.eventTime}",
            "Event Type": "${latestEvent.eventType}",
            "Event Type Key": "${latestEvent.eventTypeKey}",
            "Application Name": "${latestEvent.application.name}",
            "Node Name": "${latestEvent.node.name}",
            "Message": "${latestEvent.eventMessage}",
            "Severity": "${latestEvent.severity}"
          },
          "contexts":[
            {
              "type": "image",
              "src": "${latestEvent.severityImage.deepLink}",
              "alt": "${latestEvent.severity}"
            },
            {
              "type": "link",
              "href": "${latestEvent.deepLink}",
              "text": "View this transaction in AppDynamics"
            }
          ]
    }

    Tip: See the FAQ at the bottom of the page once you’ve completed the integration for details on how you can custimize alert data.

  5. In the Response Handling Criteria section, under Success Criteria, click Add Success Criteria. Select 200 from the Status Code list, check Expect Payload, and set the Content Type to application/json.

  6. Check One Request Per Event in the Settings section, then click Save.

  7. Once your template is saved you can test it to make sure an incident is created in PagerDuty. Click the Test button, then click Add Event Type and select an event you want to test (our example uses “Health Rule Violation Started – Warning”, but you can pick any event type), then click Run Test. Now check your PagerDuty account to ensure an incident was created.

    If you do not see an incident triggered in PagerDuty, scroll to the very bottom of the Test Transcript and check the Response Payload for any errors.

  8. Click Actions on the left menu, select an application or database to create actions for, then click Create Action.

  9. Select Make an HTTP Request from the list and click OK.

  10. Give the action a name (like “PagerDuty Trigger”) and select the template you just created from the list, then click Save.

  11. Create another action that will be used for resolving incidents. Give the action a Name (like “PagerDuty Resolve”) and select the template you just created again. When the form populates, change the pd_event_type for this new action from trigger to resolve, then click Save.

  12. The final step is to add these new actions to your desired policies. Click Policies on the left menu, and either edit or create a new policy with the settings you would like to trigger an incident in PagerDuty on the Trigger tab.

  13. Click the Actions tab on the left and click the plus + button under Actions to Execute. Select the desired action for your trigger conditions, click Select, then click Save.

  14. Congratulations! You should now receive incidents in PagerDuty whenever a policy trigger condition is met.

    Don’t forget to create policies with your desired recovery trigger conditions that will execute the “PagerDuty Resolve” action to automatically resolve incidents in PagerDuty whenever a monitored application or database recovers.

FAQ

How do you configure AppDynamics to trigger incidents on different services in PagerDuty?

If you create additional actions in AppDynamics using the same HTTP Request Template, you can change the pd_integration_key variable on the action to another service’s integration key, then simply adjust the policies for the applications or databases you want to trigger incidents on a different PagerDuty service to use the action with the alternate pd_integration_key.

Will AppDynamics incidents automatically resolve?

Yes, as long as you create an additional recovery action and policies to execute that recovery action (steps 8-14), AppDynamics will automatically resolve incidents in PagerDuty.

How do I customize the data sent from AppDynamics to PagerDuty?

You can customize the data sent to PagerDuty by changing the JSON specified in the Payload section of your HTTP Request Template. If there are more AppDynamics Predefined Templating Variables, or any other data that you would like to include in the JSON template, you may add them in the details or contexts arrays. Be sure to check out our Events API documentation for more details on the data you can send to PagerDuty.