# Dynatrace

{% hint style="danger" %}
&#x20;This connector is no longer working due to recent changes on the external application's side. We are currently working on an updated version of this connector.

In the meantime, please use the [Generic Connector](https://docs.aisera.com/aisera-platform/adding-data-to-your-tenant/integrations-and-data-sources/using-the-generic-connector) to connect to the external application. We will update this documentation once the new connector is available.
{% endhint %}

{% hint style="danger" %}
Refer to the V2 API documentation for use with the Generic Connector at this link: <https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/events-v2/get-events>
{% endhint %}

## Overview

This page outlines the steps to set up a Dynatrace connector for action or data source configurations.

## Prepare

### Endpoint

You will need the base URL for your Dynatrace instance. This will look like `https://<your_domain>.live.dynatrace.com`

### Authentication

You will need to generate a **Token** for the Aisera Platform to authenticate with Dynatrace. Instructions on how to do this can be found at [Dynatrace API - Tokens and authentication](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/basics/dynatrace-api-authentication).

## Integration Setup

1. In the Aisera Admin UI navigate to **Settings > Integrations**
2. Click on **+ New Integration**
3. In the menu, select **Dynatrace** and click **Next**\ <br>

   <figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FstnidegNhs0S96xrMNuF%2FDynatraceConnector-IntegrationSelection.png?alt=media&#x26;token=2437d9b1-bfd8-4368-bf65-45ca75b43c0c" alt=""><figcaption></figcaption></figure>
4. Enter the **Configuration** details and select **Next**

   <table><thead><tr><th width="157.20001220703125">Field</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>The name used to identify the integration</td></tr><tr><td>Endpoint</td><td>The base URL for your Dynatrace instance</td></tr><tr><td>Description</td><td>A description of the integration and it's purpose</td></tr></tbody></table>

   <div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FF2BHlmAEgufK7nGaZExY%2Fimage.png?alt=media&#x26;token=95a4b56d-45ea-46d7-9075-9302652bc015" alt=""><figcaption></figcaption></figure></div>
5. Input the token you generated for authentication
6. Click **OK** to save the integration

## Data Source Setup

To configure the Dynatrace data source:

1. In the Aisera Admin UI navigate to **Settings > Data Sources**
2. Click **+ New Data Source** in the upper right corner
3. Select **Dynatrace** and click **Next**<br>

   <figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FtYKwD27SKDPJGhlAB8zS%2FDynatraceConnector-DSSelection.png?alt=media&#x26;token=591b0ced-b942-456d-8f34-2a97d5b950ec" alt=""><figcaption></figcaption></figure>
4. Select **Alerts Learning** under the **Functions** dropdown<br>

   <div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FLCX2PHmVVCboLSuHoK6M%2Fimage.png?alt=media&#x26;token=2188d992-d6e5-4496-92cd-9378761a6831" alt=""><figcaption></figcaption></figure></div>
5. Input the general configurations and click **Next**<br>

   <table><thead><tr><th width="149.20001220703125">Field</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>The name used to identify the data source.</td></tr><tr><td>Integration</td><td>The integration with the necessary authentication information for data retrieval.</td></tr><tr><td>Schedule</td><td>This determines how often the Data Source will request new data.</td></tr><tr><td>Data Retrieval</td><td><p>How you would like the data to be retrieved.<br></p><p><strong>Incremental</strong> - Will retrieve only the data which has been created or updated since the last data ingestion</p><p><br><strong>Date Range</strong> - Will pull data from a specified Date Range. If the end date is left blank it will pull all articles after the specified start date.</p></td></tr><tr><td>Description</td><td>A description of the integration and it's purpose.</td></tr></tbody></table>
6. All configurations in **Step 3 of 4: Configuration** are optional. See the section below for more information. Click **Next** to proceed.
7. You will need to provide a JSON for the Overrides Configuration. Edit the following JSON to include the following:

   1. **BASE\_URL** - This should be replaced by the base URL of the Dynatrace instance, for example `https://<your_domain>.live.dynatrace.com`&#x20;
   2. **extraQueryTextConfiguration** - Replace the default parameter key, "`entitySelector"`, with "`eventSelector"` if you want the Custom Query to use this query parameter instead.

   <pre class="language-json" data-full-width="false"><code class="lang-json">{
     "xml2json": false,
     "externalSystemTypeEnum": "Generic",
     "supportectContentTypes": [
       "Alert"
     ],
     "contentTypeConfiguration": {
       "Alert": {
         "appliesToChildren": true,
         "httpContentType": "application/json",
         "acceptContentType": "application/json",
         "requestCharset": "utf-8",
         "pagination": {
           "type": "element",
           "nextLinkPath": "nextPageKey",
           "discardDot": false,
           "appendToBaseUrl": false,
           "limitParam": "pageSize",
           "defaultLimit": 1000,
           "defaultOffset": 0,
           "dateFormat": "unix_timestamp",
           "parameters": [
             {
               "field": "from",
               "operator": "eq",
               "value": "{_startDate_}"
             },
             {
               "field": "to",
               "operator": "eq",
               "value": "{_endDate_}"
             }
           ],
           "tableEntriesArrayPath": "events",
           "tableEntryPath": "top",
           "isTableEntryJSONArray": true,
           "retriesNo": 0,
           "appendTopElement": false,
           "overrideWithDefaultLimit": true
         },
         "pathMappings": [
           {
             "path": "/api/v2/events",
             "pathByKey": "/api/v2/events/{_key_}"
           }
         ],
         "supportedOperations": [
           "LIST"
         ],
         "operations": [
           {
             "operation": "LIST",
             "httpMethod": "get",
             "headers": {},
             "useFormPayload": false,
             "useBinaryPayload": false,
             "customClose": false,
             "returnGetTableEntryOnClose": false,
             "customAddComment": false,
             "useCreatePathInUpdate": false,
             "listEntryJoltTransforms": []
           }
         ],
         "respectRequestPaginationInCount": false,
         "respectEndDate": false,
         "respectStartDate": false,
         "discardEntriesOutOfStartOrEndDate": false,
         "handleNullDatesConfiguration": true,
         "handleDefaultDatesConfiguration": true,
         "nullDateStartHoursBefore": -262800,
         "nullDateEndHoursAfter": 24,
         "addElementAsArrayUnderTop": false,
         "downloadFiles": false,
         "timezone": "UTC",
         "doNotFailOnNestedCall": false,
         "isAttachment": false,
         "isFileDownloadRequest": false,
         "responseTransformationScript": "var nextPageKey = jsobject.nextPageKey;\nif (nextPageKey) {\n\tjsobject.nextPageKey = \"BASE_URL/api/v2/events?nextPageKey=\" + nextPageKey;\n}\n\njsobject;",
         "prefetchConfigurations": []
       }
     },
     "accessTokenPrefix": "Api-Token ",
     "basicTokenAuth": true,
     "startDate": false,
     "endDate": false,
     "extraQueryTextConfiguration": {
       "parameter": "entitySelector",
       "mode": "PARAM"
     },
     "sleepOnErrors": 1000,
     "retries": 1,
     "rateLimitRespectNo": 0,
     "rateLimitEntriesSize": 300,
     "sleepOnRateLimit": 1000,
     "accessTokenHeader": "Authorization",
     "timezone": "UTC",
     "record": false,
     "useInterval": false,
     "interval": 0,
     "disableFetchingServiceCatalogCategories": false,
     "githubRepos": [],
     "ingestGithubPullRequestCommits": false,
     "ingestGithubPullRequestReviewComments": false,
     "ingestGithubPullRequestComments": false,
     "externalSystemClientV2": {
       "configuration": {
         "host": "tenant-server",
         "port": 8088,
         "apiBasePath": "/tenant-server/v2",
         "trustAnySSLCertificate": true
       }
     },
     "externalSystemId": 0,
     "secondReading": false,
     "hasImageProfile": true,
     "bypassNestedCallsForTestConnection": false,
     "authType": "Token",
     "useRawToken": false,
     "useRemoteExecutor": false,
     "useUserCredentials": false,
     "trustAnySSLCertificate": true,
     "contextParameters": {}
   }
   </code></pre>
8. Click **OK** to save the data source.

## Optional Configurations

#### Bypass Test Connection <a href="#bypass-test-connection" id="bypass-test-connection"></a>

Disable if you want to bypass the test connection

#### Custom Query <a href="#transformation-script" id="transformation-script"></a>

This field accepts values that will be included in the Query Parameters in the API request from the connector to Dynatrace. For example, if the value `type("ENVIRONMNET")` is inserted into the field, the query parameter `entitySelector=type("ENVIRONMENT")` will be added to the request made to Dynatrace. The key of this query parameter is determined by the provided override configuration JSON provided.

#### Transformation Script <a href="#transformation-script" id="transformation-script"></a>

This field is used to transform data at it is being ingested into the Aisera platform. This script is written in JavaScript.

## Post Setup Actions

### Data Ingestion

After you've successfully set up your connector, your data will automatically sync according to the schedule settings or on demand, as specified during the Data Source Configuration step. However, you should perform a manual sync immediately. This initial run will serve two key purposes:

After setting up your connector, your data will sync automatically based on your schedule parameters, or you can choose the "on demand" configuration to sync data only when requested.

1. It confirms the connector is working properly.
2. It provides an immediate view of the information being ingested into the Aisera Application, allowing you to validate and begin working with the data.

To manually ingest data:

1. In the Aisera Admin UI navigate to **Settings > Data Sources.**<br>

   <div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FUIsDFUfemqsV7ML86iHS%2FDataIngestion-DataSourceWindow.png?alt=media&#x26;token=c41635bd-16b9-4b13-b35b-84705fa26309" alt=""><figcaption><p>Data Sources Window</p></figcaption></figure></div>
2. **Click** on the **Data Source** you wish to manually ingest data from.
3. At the top right of the **Data Source Details** page, click the **Play** button to manually ingest data.<br>

   <figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FWOAAURoDxlvnQcfI7gws%2FDataIngestion-DataSourceDetailsWindow.png?alt=media&#x26;token=41069e6a-e0be-4924-a9b2-41aae8fb5d43" alt=""><figcaption><p>Data Source Window</p></figcaption></figure>
