# Dynatrace

> Work with Dynatrace monitoring: read problems and comment on them, send events such as deployments and alerts, and send custom metric data points. Start a workflow for each new problem.

App · 9 actions. Web page: https://docs.lodol.com/docs/integrations/dynatrace

## Actions

### Add problem comment

Post a comment on a problem, for example what was done about it. Returns the comment, including its ID.

**Inputs**

- Problem ID (`problem_id`, text, required): The problem's ID, like -1234567890123456789_1234567890123V2, from 'List problems' or an earlier step. Not the short P-24014 number.
- Comment (`message`, text, required): The text of the comment.
- Source (`context`, text): Where the comment comes from, shown beside it. Defaults to Lodol.

**Outputs**

- `comment` (object): The comment
- `problem_id` (text): The problem the comment is on

**Example output**

```json
{
  "comment": {
    "authorName": "Lodol",
    "content": "Investigating, restarting the service.",
    "context": "Lodol",
    "createdAtTimestamp": 1760000100000,
    "id": "7351938490248201"
  },
  "problem_id": "-1234567890123456789_1234567890123V2"
}
```

### Delete problem comment

Delete a comment from a problem.

**Inputs**

- Problem ID (`problem_id`, text, required): The problem's ID, like -1234567890123456789_1234567890123V2, from 'List problems' or an earlier step. Not the short P-24014 number.
- Comment ID (`comment_id`, text, required): The comment's ID, from 'List problem comments' or 'Add problem comment'.

**Outputs**

- `comment_id` (text): The comment deleted
- `deleted` (true/false): Always true once deleted
- `problem_id` (text): The problem

**Example output**

```json
{
  "comment_id": "7351938490248201",
  "deleted": true,
  "problem_id": "-1234567890123456789_1234567890123V2"
}
```

### Get problem

Get one problem with its root cause, affected entities and management zones. Optionally add the evidence, impact analysis and recent comments.

**Inputs**

- Problem ID (`problem_id`, text, required): The problem's ID, like -1234567890123456789_1234567890123V2, from 'List problems' or an earlier step. Not the short P-24014 number.
- Extra details (`fields`, list): Add these to the problem. They make the answer larger. One or more of: `evidenceDetails` (Root cause evidence), `impactAnalysis` (Impact analysis), `recentComments` (Recent comments).

**Outputs**

- `problem` (object): The problem

**Example output**

```json
{
  "problem": {
    "affectedEntities": [
      {
        "entityId": {
          "id": "HOST-0123456789ABCDEF",
          "type": "HOST"
        },
        "name": "web-01"
      }
    ],
    "displayId": "P-24014",
    "endTime": -1,
    "entityTags": [],
    "evidenceDetails": null,
    "impactAnalysis": null,
    "impactLevel": "INFRASTRUCTURE",
    "impactedEntities": [
      {
        "entityId": {
          "id": "HOST-0123456789ABCDEF",
          "type": "HOST"
        },
        "name": "web-01"
      }
    ],
    "managementZones": [
      {
        "id": "1234",
        "name": "Production"
      }
    ],
    "problemId": "-1234567890123456789_1234567890123V2",
    "recentComments": null,
    "rootCauseEntity": {
      "entityId": {
        "id": "HOST-0123456789ABCDEF",
        "type": "HOST"
      },
      "name": "web-01"
    },
    "severityLevel": "RESOURCE_CONTENTION",
    "startTime": 1760000000000,
    "status": "OPEN",
    "title": "High CPU saturation"
  }
}
```

### List event types

List the kinds of event Dynatrace can raise, with their severity.

**Inputs**

- Page size (`page_size`, number): How many event types to return, 1 to 500. Dynatrace's default is 100. From 1 to 500.
- Next page key (`next_page_key`, text): The 'next_page_key' from an earlier page, to get the page after it. All other filters are then ignored, as Dynatrace requires.

**Outputs**

- `count` (number): How many are in this page
- `event_types` (list): The event types
- `next_page_key` (text): Pass this as 'Next page key' to get the next page; empty on the last page
- `total_count` (number): How many there are in all, as Dynatrace counts them
- `warnings` (list): Warnings from Dynatrace about the query

**Example output**

```json
{
  "count": 1,
  "event_types": [
    {
      "description": "A deployment sent from outside Dynatrace.",
      "displayName": "Custom deployment",
      "severityLevel": "INFO",
      "type": "CUSTOM_DEPLOYMENT"
    }
  ],
  "next_page_key": "",
  "total_count": 1,
  "warnings": []
}
```

### List problem comments

List the comments on a problem. Returns one page.

**Inputs**

- Problem ID (`problem_id`, text, required): The problem's ID, like -1234567890123456789_1234567890123V2, from 'List problems' or an earlier step. Not the short P-24014 number.
- Page size (`page_size`, number): How many comments to return, 1 to 500. Dynatrace's default is 10. From 1 to 500.
- Next page key (`next_page_key`, text): The 'next_page_key' from an earlier page, to get the page after it. All other filters are then ignored, as Dynatrace requires.

**Outputs**

- `comments` (list): The comments
- `count` (number): How many are in this page
- `next_page_key` (text): Pass this as 'Next page key' to get the next page; empty on the last page
- `total_count` (number): How many there are in all, as Dynatrace counts them
- `warnings` (list): Warnings from Dynatrace about the query

**Example output**

```json
{
  "comments": [
    {
      "authorName": "Lodol",
      "content": "Investigating, restarting the service.",
      "context": "Lodol",
      "createdAtTimestamp": 1760000100000,
      "id": "7351938490248201"
    }
  ],
  "count": 1,
  "next_page_key": "",
  "total_count": 1,
  "warnings": []
}
```

### List problems

List the problems Dynatrace saw in a time range, filtered by status, severity, impact, management zone, entity or text. Gets one page; to see more, run it again with the next page it gives.

**Inputs**

- Time range (`timeframe`, text): How far back to look. Ignored when 'From' is set. Dynatrace's default is the last 2 hours. One of: `now-1h` (Last hour), `now-2h` (Last 2 hours (default)), `now-6h` (Last 6 hours), `now-24h` (Last 24 hours), `now-3d` (Last 3 days), `now-7d` (Last 7 days), `now-30d` (Last 30 days).
- From (`from_time`, date and time): Start of an exact time range. Replaces 'Time range'.
- To (`to_time`, date and time): End of the time range. Defaults to now.
- Status (`status`, text): Only open or only closed problems. Leave empty for both. One of: `open`, `closed`.
- Severity (`severity`, list): Only problems of these kinds. Leave empty for all. One or more of: `AVAILABILITY`, `ERROR`, `PERFORMANCE` (Slowdown), `RESOURCE_CONTENTION` (Resource), `CUSTOM_ALERT` (Custom alert), `MONITORING_UNAVAILABLE` (Monitoring unavailable), `INFO`.
- Impact (`impact`, list): Only problems that impact these. Leave empty for all. One or more of: `APPLICATION` (Applications), `SERVICES`, `INFRASTRUCTURE`, `ENVIRONMENT`.
- Management zone (`management_zone`, text): Only problems in management zones whose name contains this.
- Affected entity ID (`entity_id`, text): Only problems that affect this entity, like HOST-0123456789ABCDEF.
- Search text (`text`, text): Only problems whose title or entity matches, up to 30 characters.
- Advanced selector (`problem_selector`, text): More of Dynatrace's problem selector, such as entityTags("env:prod"). Added to the filters above.
- Order (`sort`, text): Sort by start time. Dynatrace's default is open problems first. One of: `-startTime` (Newest first), `+startTime` (Oldest first).
- Extra details (`fields`, list): Add these to each problem. They make the answer larger. One or more of: `evidenceDetails` (Root cause evidence), `impactAnalysis` (Impact analysis), `recentComments` (Recent comments).
- Page size (`page_size`, number): How many problems to return, 1 to 500. Dynatrace's default is 50. From 1 to 500.
- Next page key (`next_page_key`, text): The 'next_page_key' from an earlier page, to get the page after it. All other filters are then ignored, as Dynatrace requires.

**Outputs**

- `count` (number): How many are in this page
- `next_page_key` (text): Pass this as 'Next page key' to get the next page; empty on the last page
- `problems` (list): The problems
- `total_count` (number): How many there are in all, as Dynatrace counts them
- `warnings` (list): Warnings from Dynatrace about the query

**Example output**

```json
{
  "count": 1,
  "next_page_key": "",
  "problems": [
    {
      "affectedEntities": [
        {
          "entityId": {
            "id": "HOST-0123456789ABCDEF",
            "type": "HOST"
          },
          "name": "web-01"
        }
      ],
      "displayId": "P-24014",
      "endTime": -1,
      "entityTags": [],
      "evidenceDetails": null,
      "impactAnalysis": null,
      "impactLevel": "INFRASTRUCTURE",
      "impactedEntities": [
        {
          "entityId": {
            "id": "HOST-0123456789ABCDEF",
            "type": "HOST"
          },
          "name": "web-01"
        }
      ],
      "managementZones": [
        {
          "id": "1234",
          "name": "Production"
        }
      ],
      "problemId": "-1234567890123456789_1234567890123V2",
      "recentComments": null,
      "rootCauseEntity": {
        "entityId": {
          "id": "HOST-0123456789ABCDEF",
          "type": "HOST"
        },
        "name": "web-01"
      },
      "severityLevel": "RESOURCE_CONTENTION",
      "startTime": 1760000000000,
      "status": "OPEN",
      "title": "High CPU saturation"
    }
  ],
  "total_count": 1,
  "warnings": []
}
```

### Send event

Send a custom event to Dynatrace, such as a deployment marker, an annotation or an alert. Alert-type events open a problem.

**Inputs**

- Event type (`event_type`, text, required): What kind of event this is. Deployments, annotations and info events only show on charts and entity pages; the others open a problem. One of: `CUSTOM_INFO` (Info (no problem)), `CUSTOM_ANNOTATION` (Annotation (no problem)), `CUSTOM_DEPLOYMENT` (Deployment (no problem)), `CUSTOM_CONFIGURATION` (Configuration change (no problem)), `MARKED_FOR_TERMINATION` (Marked for termination (no problem)), `CUSTOM_ALERT` (Custom alert (opens a problem)), `ERROR_EVENT` (Error (opens a problem)), `AVAILABILITY_EVENT` (Availability (opens a problem)), `PERFORMANCE_EVENT` (Slowdown (opens a problem)), `RESOURCE_CONTENTION_EVENT` (Resource contention (opens a problem)), `WARNING` (Warning (opens a problem)).
- Title (`title`, text, required): The event's title.
- Entity selector (`entity_selector`, text): Which entities the event belongs to, such as type("SERVICE"),entityName.equals("checkout"). Leave empty to attach it to the whole environment.
- Properties (`properties`, object): Extra details to keep on the event, as names and values.
- Start (`start_time`, date and time): When the event starts. Defaults to now.
- End (`end_time`, date and time): When the event ends. Defaults to the start plus the time-out.
- Time-out (minutes) (`timeout_minutes`, number): How long the event stays open without being sent again, 1 to 360. Dynatrace's default is 15. From 1 to 360.

**Outputs**

- `correlation_id` (text): Dynatrace's correlation ID for the new event
- `report_count` (number): Events created
- `results` (list): Dynatrace's result for each event
- `status` (text): OK once Dynatrace took it

**Example output**

```json
{
  "correlation_id": "933613657e1c8fcf",
  "report_count": 1,
  "results": [
    {
      "correlationId": "933613657e1c8fcf",
      "status": "OK"
    }
  ],
  "status": "OK"
}
```

### Send metric data point

Send one data point of a custom metric to Dynatrace. The metric is created on first use and shows in charts within a minute or two.

**Inputs**

- Metric key (`metric_key`, text, required): A name for your own metric, like custom.orders.processed. Keys starting with dt. are reserved by Dynatrace.
- Value (`value`, number, required): The number to record.
- Dimensions (`dimensions`, object): Names and values that split the metric, like region and eu-west. Each different combination is its own series.
- Time (`timestamp`, date and time): When the value was measured. Defaults to now.

**Outputs**

- `line` (text): The line that was sent
- `lines_invalid` (number): Data points it refused
- `lines_ok` (number): Data points Dynatrace took
- `warnings` (text): A warning from Dynatrace, such as a changed metric key

**Example output**

```json
{
  "line": "custom.orders.processed,region=eu-west 42",
  "lines_invalid": 0,
  "lines_ok": 1,
  "warnings": ""
}
```

### Update problem comment

Replace the text of a comment on a problem.

**Inputs**

- Problem ID (`problem_id`, text, required): The problem's ID, like -1234567890123456789_1234567890123V2, from 'List problems' or an earlier step. Not the short P-24014 number.
- Comment ID (`comment_id`, text, required): The comment's ID, from 'List problem comments' or 'Add problem comment'.
- Comment (`message`, text, required): The text of the comment.
- Source (`context`, text): Where the comment comes from, shown beside it. Defaults to Lodol.

**Outputs**

- `comment` (object): The comment
- `problem_id` (text): The problem the comment is on

**Example output**

```json
{
  "comment": {
    "authorName": "Lodol",
    "content": "Investigating, restarting the service.",
    "context": "Lodol",
    "createdAtTimestamp": 1760000100000,
    "id": "7351938490248201"
  },
  "problem_id": "-1234567890123456789_1234567890123V2"
}
```
