Problems API

Problem endpoint

https://{id}.live.dynatrace.com/api/v1/problem/

This family of endpoints delivers metrics and details about problems that Dynatrace detects within a given environment. The returned list of problems is identical to that shown in the Dynatrace Web UI and within the Dynatrace mobile app. A single problem typically contains summary information, impact analysis, and a list of any events that are correlated with the problem.

The Dynatrace Problems API follows a particular strategy. First, high-level status information is returned by calling the status endpoint. Then the current problem feed is fetched (minimal problem details included) by calling the feed endpoint. Once a problem is identified, the API calls the details endpoint to fetch all detailed information related to the problem. Note that problem details are often large in size.

Status endpoint

https://{id}.live.dynatrace.com/api/v1/problem/status

A call to the /problem/status endpoint returns the number of currently open problems organized by impact level (i.e., affecting applications, services, or infrastructure) so you know immediately when problems affect your customers.

Result

  • totalOpenProblemsCount: Number of open problems in your environment.
  • openProblemCounts: Number of open problems in your environment, organized by impact level (application, services, and/or infrastructure).

The following code block shows an example result:

{
  result: {
    totalOpenProblemsCount: 4,
    openProblemCounts: {
      APPLICATION: 1,
      INFRASTRUCTURE: 3,
      SERVICE: 0
    }
  }
}

Feed endpoint

https://{id}.live.dynatrace.com/api/v1/problem/feed

A call to /problem/feed returns the list of problems observed by Dynatrace during a relative period of time. Complete problem details may be large because the feed contains a subset of each problems’ meta information to give the caller the option of selecting all detail from specific problems. The /problem/feed endpoint offers additional query and filter parameters to enable you to specify which types of problems the API consumer is interested in.

HTTP GET parameters

The feed endpoint allows the following parameters to be sent as HTTP GET requests:

  1. status (optional) Possible values: OPEN or CLOSED; Filters the resulting set of problems according to their status (OPEN or CLOSED) Without status filtering the call returns all problems for the given time period.
  2. impactLevel (optional) Possible values: APPLICATION, SERVICE or INFRASTRUCTURE; Filters the resulting set of problems based on impact level: applications (APPLICATION), services (SERVICE), or infrastructure component (INFRASTRUCTURE). Without impactLevel filtering, the call returns all problems for the given time period.
  3. relativeTime (optional) Possible values: hour, 2hours, 6hours, day, week, month; Specifies the relative time period for receiving the problem feed. Without specifying this parameter, the call returns all problems observed by Dynatrace within the last hour.

A call to problem/feed delivers a list of problem summaries along with the overall count of monitored applications, services, and infrastructure components in your monitored environment.

The following example shows the result of a successful call to the problems feed:

{
  result: {
    problems: [
      {
        id: "1328992236593193841",
        startTime: 1453166820000,
        endTime: -1,
        displayName: "851",
        impactLevel: "INFRASTRUCTURE",
        status: "OPEN",
        rankedImpacts: [
          {
              entityId: "HYPERVISOR-CC7586844F686D21",
              entityName: "emea-gdn-vh026.emea.cpwr.corp",
              impactLevel: "INFRASTRUCTURE",
              eventType: "CPU_SATURATED"
          }
        ],
        affectedCounts: {
          APPLICATION: 0,
          INFRASTRUCTURE: 1,
          SERVICE: 0
        },
        recoveredCounts: {
          APPLICATION: 0,
          INFRASTRUCTURE: 0,
          SERVICE: 0
        }
      },
      ...
    ],
    monitored: {
      INFRASTRUCTURE: 1599,
      SERVICE: 56,
      APPLICATION: 10
    }
  }
}

Problem details endpoint

https://{id}.live.dynatrace.com/api/v1/problem/details/{problemid}

To fetch complete meta information for a specific problem, the API consumer must call the endpoint /problems/details/{problemid}. The placeholder {problemid} must be replaced with the actual unique problem ID generated by Dynatrace. Problem IDs are found within the ID fields of each problem in the problem-feed JSON result. The problem/details endpoint returns all problem meta information, including start time (startTime), end time (endTime, -1 if the problem is still open), the short problem number (displayName), impact level, and status. Problem information also contains the array of events that were identified by Dynatrace as being relevant to the given problem. Each single event contains information about its impacted entity (entityId, entityName), the type of event, and the severity level of the given event.

The following example result shows an infrastructure problem that contains a CPU event on the given host:

{
  result: {
    id: "1328992236593193841",
    startTime: 1453166820000,
    endTime: -1,
    displayName: "851",
    impactLevel: "INFRASTRUCTURE",
    status: "OPEN",
    rankedEvents: [
      {
        startTime: 1453166820000,,
        endTime: 9223372036854776000,
        entityId: "HYPERVISOR-CC7586844F686D21",
        entityName: "emea-gdn-vh026.emea.cpwr.corp",
        impactLevel: "INFRASTRUCTURE",
        eventType: "CPU_SATURATED"
        status: "OPEN",
        severities: [
          {
            context: "CPU_USAGE",
            value: 96.42066955566406,
            unit: "%"
          },
          {
            context: "CPU_READY_TIME",
            value: 18.439342498779297,
            unit: "%"
          }
        ]
      }
    ]
  }
}

Problem comments endpoint

You can share insights related to remediation actions or additional information about possible root causes by attaching comments to detected problems. The problem comments REST endpoint enables third party integrations to push comments to existing problems or to share the collected feed of comments through the API.

There are two ways to push comments to an existing problem. The typical approach to adding comments to problems is to use the problem details page, as shown below.

Use the following HTTP GET request to retrieve the comments feed for a given problem:

https://{id}.live.dynatrace.com/api/v1/problem/details/{PID}/comments

The following example shows the result of a successful call to a problem’s comments feed:

{
comments: [
{
id: -5785321710852868000,
createdAtTimestamp: 1477561321162,
content: "My UI comment. This is a known issue caused by a backup process run.",
userName: "wolfgang@email.com",
context: null
},
{
id: -2656985228510593500,
createdAtTimestamp: 1474543966351,
content: "This is a comment with an [inline-style link](https://www.google.com).",
userName: "Wolfgang",
context: "Slack"
}
]
}

Use an HTTP POST request to create a new comment for an existing problem: https://{id}.live.dynatrace.com/api/v1/problem/details/{PID}/comments

The payload must contain the following JSON-encoded message, where the user attribute shows which user sent the comment and the context attribute shows the comments source. The example below shows a comment that the user Wolfgang has sent through the Slack team chat system to Dynatrace:

{  
"comment" : "Contains the actual comment text with an [inline-style link](https://www.google.com).", 
"user" : "Wolfgang", 
"context" : "Slack" 
}

Use the following HTTP DELETE request to delete an existing comment. Replace {PID} with the problem’s unique ID and {CID} with the comment’s unique ID:

https://{id}.live.dynatrace.com/api/v1/problem/details/{PID}/comments/{CID}

Use an HTTP PUT request to edit and change an existing comment where the payload message is the same as for the POST call. Replace {PID} with the problem’s unique ID and {CID} with the comment’s unique ID:

https://{id}.live.dynatrace.com/api/v1/problem/details/{PID}/comments/{CID}