> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flashcat.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# AppDynamics Alert Integration

> Sync AppDynamics alerts to Flashduty via webhook for automated alert noise reduction

Sync AppDynamics alerts to Flashduty via webhook for automated alert noise reduction.

<div class="hide">
  ## In Flashduty

  ***

  You can obtain an integration push URL through either of these two methods:

  ### Using Private Integration

  Choose this method when you don't need to route alerts to different channels. It's simpler.

  <details>
    <summary>Expand</summary>

    1. Go to the Flashduty console, select **Channel**, and enter a channel's details page
    2. Select the **Integration** tab, click **Add Integration**, and enter the integration page
    3. Choose **AppDynamics** integration and click **Save** to generate a card
    4. Click the generated card to view the **Push URL**, copy it for later use, and you're done
  </details>

  ### Using Shared Integration

  Choose this method when you need to route alerts to different channels based on the alert payload information.

  <details>
    <summary>Expand</summary>

    1. Go to the Flashduty console, select **Integration Center=>Alerts**, and enter the integration selection page
    2. Select **AppDynamics** integration:
       * **Integration Name**: Define a name for this integration
    3. Configure the default route and select the corresponding channel (after the integration is created, you can go to `Route` to configure more routing rules)
    4. Click **Save** and copy the newly generated **push URL** for later use
    5. Done
  </details>
</div>

## In AppDynamics

***

<div class="md-block">
  ## I. AppDynamics Alert Push Configuration

  ### Step 1: Configure Flashduty Alert Channel

  1. Log in to your AppDynamics console
  2. Find `Alert Respond`, select `HTTP Request Templates`, and click `New` to create an alert channel

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-1.png" />

  3. In the template configuration, enter **Flashduty** as the `Name`
  4. In the `Request URL` section, select **POST** as the `Method`, and enter the integration push URL in `Raw URL` (enter the integration name on this page, and the URL will be generated after saving)

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-2.png" />

  5. In the `Payload` section, select `application/json` as `MIME Type` and `UTF-8` as `Payload Encoding`
  6. Paste the following content in the `Payload` text box:

  ```
  {
  	"policy_name":"${policy.name}",
  	"message": "${latestEvent.eventMessage}",
  	"application_name": "${latestEvent.application.name}",
  	"link": "${latestEvent.deepLink}",
  	"incident_id": "${latestEvent.incident.id}",
  	"details": {
  		"event_id": "${latestEvent.id}",
  		"event_name": "${latestEvent.displayName}",
  		"event_time": "${latestEvent.eventTime}",
  		"event_type": "${latestEvent.eventType}",
  		"health_rule_name":"${latestEvent.healthRule.name}",
  		"node_name": "${latestEvent.node.name}",
  		"severity": "${latestEvent.severity}"
  	}
  }
  ```

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-3.png" />

  **Special Note (Optional Configuration)**

  Configuration: `Custom Templating Variables`

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-5.png" />

  If you need to configure `Custom Templating Variables`, you can refer to the following JSON template. Here, custom\_variables is a fixed format, and the variables within custom\_variables are custom `Variables`. The names defined on the page should match the variable names referenced in the JSON template.

  ```
  {
  	"policy_name":"${policy.name}",
  	"message": "${latestEvent.eventMessage}",
  	"application_name": "${latestEvent.application.name}",
  	"link": "${latestEvent.deepLink}",
  	"incident_id": "${latestEvent.incident.id}",
  	"details": {
  		"event_id": "${latestEvent.id}",
  		"event_name": "${latestEvent.displayName}",
  		"event_time": "${latestEvent.eventTime}",
  		"event_type": "${latestEvent.eventType}",
  		"health_rule_name":"${latestEvent.healthRule.name}",
  		"event_type_key": "${latestEvent.eventTypeKey}",
  		"node_name": "${latestEvent.node.name}",
  		"severity": "${latestEvent.severity}"
  	},
  	"custom_variables":{
  		"host":"${host}"
  	}
  }
  ```

  7. In the `Response Handling Criteria` section, set the `Failure Criteria` status code to 400 and the `Success Criteria` status code to 201

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-4.png" />

  8. Click `Save` to complete

  ### Step 2: Create Action

  1. Select `Actions` in the left navigation bar, choose the application type you want to create for, and click `Create`
  2. In the `Create Action` popup, select `Make an HTTP Request` and click `OK`

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-6.png" />

  3. In the `Create HTTP Action` popup, enter a Name, select **Flashduty** created in `Step 1` as the `HTTP Request Template`, and click `SAVE`

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-7.png" />

  ### Step 3: Use the Action Created in Step 2 in Alert Policies

  1. Select `Policies` in the left navigation bar
  2. Create or edit existing policies (configure alert rules as needed, alert rule configuration is omitted here)
  3. In the `Actions` section of the policy configuration page, click add and select the Action created in `Step 2`

  <img alt="drawing" width="600" src="https://download.flashcat.cloud/flashduty/doc/appdyn-8.png" />

  4. After completing other configurations, click `Save` to finish
</div>

## II. Status Mapping

<div class="md-block">
  | AppDynamics | Flashduty | Status   |
  | ----------- | --------- | -------- |
  | ERROR       | Critical  | Critical |
  | WARN        | Warning   | Warning  |
  | INFO        | Info      | Info     |
</div>
