Dynatrace offers several out-of-the-box integrations that automatically push problem notifications to third-party incident-management and ChatOps systems.
If however your third-party system isn't supported with an out-of-the-box integration, you can easily set up a customizable webhook integration. Using this approach, whenever Dynatrace detects a problem in your environment that affects real users, a webhook triggers an HTTP POST
request to a target URL that you specify.
The payload message of the HTTP POST
request is completely customizable. By default, requests use valid JSON syntax except that you define a different HTTP content type header. In case you define a different HTTP content type header, Dynatrace will skip the JSON validation. In such cases, Dynatrace doesn't escape the payload based on JSON syntax. Information placeholders, such as {ProblemTitle} and {State}, are used to fill the custom JSON with the dynamic information of each detected problem.
To integrate problem-notifications using a custom webhook:
The Available placeholders section of the configuration page lists placeholders you can use for this integration. Placeholders are automatically replaced with problem-related information such as problem state or title.
Here is a valid JSON web hook problem-notification definition example:
{"ImpactedEntities": {ImpactedEntities},"ImpactedEntity": "{ImpactedEntity}","PID": "{PID}","ProblemDetailsHTML": "{ProblemDetailsHTML}","ProblemDetailsJSON": {ProblemDetailsJSON},"ProblemID": "{ProblemID}","ProblemImpact": "{ProblemImpact}","ProblemTitle": "{ProblemTitle}","Problem URL": "https://example.com","State": "{State}","Tags": "{Tags}"}
{ImpactedEntities}
and {ProblemDetailsJSON}
are JSON data types and must not have quotes around them.
After a problem has been detected, the placeholders are populated with the actual values and results, as shown in this example payload:
{"ImpactedEntities": [{"type": "HOST", "name": "MyHost1", "entity": "HOST-XXXXXXXXXXXXX" },{"type": "SERVICE", "name": "MyService1", "entity": "SERVICE-XXXXXXXXXXXXX"}],"ImpactedEntity": "MyHost1, MyService1","PID": "99999","ProblemDetailsHTML": "<h1>Dynatrace problem notification test run details</h1>","ProblemDetailsJSON": {"ID" : "99999" },"ProblemID": "999","ProblemImpact": "INFRASTRUCTURE","ProblemTitle": "Dynatrace problem notification test run","Problem URL": "https://example.com","State": "OPEN","Tags": "testtag1, testtag2"}