Webhook integration | Dynatrace helphttps://www.dynatrace.com/support/help/
Fri, 22 Feb 2019 10:04:41 +0100Mon, 18 Feb 2019 08:24:20 +0100Metalsmith v2.3.0Webhook integration updated on Mon, 18 Feb 2019 08:24:20 +0100<p>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&apos;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 <code>HTTP POST</code> request to a target URL that you specify.
The payload message of the <code>HTTP POST</code> 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&apos;t escape the payload based on JSON syntax. Information placeholders, such as <strong>{ProblemTitle}</strong> and <strong>{State}</strong>, are used to fill the custom JSON with the dynamic information of each detected problem.</p>
<p>To integrate problem-notifications using a custom webhook</p>
<ol>
<li>
<p>Navigate to <strong>Settings &gt; Integration &gt; Problem notifications</strong>.</p>
</li>
<li>
<p>Click <strong>Set up notifications</strong>, and select <strong>Custom integration</strong>, as shown below.</p>
</li>
</ol>
<p><img src="https://dt-cdn.net/images/webhook-1-1423-514d317b40.png" alt=""></p>
<p>The <strong>Set up custom integration</strong> page appears.</p>
<p><img src="https://dt-cdn.net/images/webhook-2-1247-5beafa54ad.png" alt=""></p>
<ol start="4">
<li>
<p>Type the following information to set up a webhook integration</p>
<ul>
<li><code>Name</code>
User-defined display name that distinguises this unique integration from other integrations.</li>
<li><code>Webhook URL</code>
Target URL where the <code>HTTP POST</code> should push the payload. This URL can contain HTTP parameters such as an authentication token, in case the destination system works with authentication tokens instead of basic authentication.</li>
<li><code>Additional HTTP headers</code> (optional)
Specify additional HTTP header fields, such as &apos;Content-Type&apos; or &apos;Authorization&apos;. These custom HTTP header fields can be used if the target endpoint needs an authentication token within the HTTP header or if you would like to send different content type such as &apos;text/plain&apos; or &apos;application/xml&apos;.</li>
<li><code>Create basic authorization header</code> (optional)
Basic authorization HTTP headers represents a username password pair that is concatenated by a colon character and finally base64 encoded. Given an example of a username &apos;alice&apos; that comes with a password &apos;hello.my.pwd&apos;. Both values are combined with a colon &apos;alice:hello.my.pwd&apos; and base64 encoded, which finally results in &apos;YWxpY2U6aGVsbG8ubXkucHdk&apos;. The basic authorization HTTP will therefore look like: &apos;Authorization&apos; : &apos;basic YWxpY2U6aGVsbG8ubXkucHdk&apos;. To save you the time to repeat the process for your own username and password, the UI button &apos;Create basic authorization header&apos; automatically generates that specific HTTP header for you just by entering your username and password.</li>
<li><code>Custom payload</code><br>
Once a problem is detected or resolved, this customizable payload is pushed through an <code>HTTP POST</code> to the target system. Use specific placeholders to dynamically populate the payload with problem-related information, such as problem state or title.</li>
</ul>
</li>
<li>
<p>Finalize, send a test notification, and click <strong>Save</strong>.</p>
</li>
<li>
<p>Use the <strong>Notification level</strong> switches to control the types of problem notifications that are sent to the target system (problems with <strong>Applications</strong>, <strong>Services</strong>, and <strong>Infrastructure</strong>).</p>
</li>
<li>
<p>Before you save your custom integration setup, click <strong>Send test notification</strong> to perform a test run and ensure that the destination address is available.</p>
</li>
</ol>
<h2 id="available-placeholders">Available placeholders
<span class="shortlink-copy shortlink-copy-js" data-clipboard-text="https://www.dynatrace.com/support/help/shortlink/webhook#available-placeholders">
</span></h2>
<ul>
<li><code>{State}</code>: Problem state. Possible values are OPEN and RESOLVED.</li>
<li><code>{ProblemID}</code>: ID number of the reported problem.</li>
<li><code>{PID}</code>: Unique system identifier of the reported problem.</li>
<li><code>{ProblemImpact}</code>: Impact level of the problem. Possible values are APPLICATION, SERVICE, and INFRASTRUCTURE.</li>
<li><code>{ProblemTitle}</code>: Short description of the problem.</li>
<li><code>{ProblemURL}</code>: URL of the details page of the corresponding problem in Dynatrace.</li>
<li><code>{ImpactedEntity}</code>: Entities impacted by the problem (or the term &quot;multiple&quot; when more than two entities are impacted).</li>
<li><code>{ImpactedEntities}</code>: A JSON array of all impacted entities in the form of:</li>
<li><code>{ProblemDetailsHTML}</code>: All problem event details, including root cause, as an HTML-formatted string.</li>
<li><code>{ProblemDetailsJSON}</code>: All problem event details, including root cause, as a JSON object.</li>
<li><code>{Tags}</code>: Comma-separated values list of tags that have been defined for all impacted entities.</li>
</ul>
<h3 id="example">Example
<span class="shortlink-copy shortlink-copy-js" data-clipboard-text="https://www.dynatrace.com/support/help/shortlink/webhook#example">
</span></h3>
<p>Here is a valid JSON web hook problem-notification definition example. After a problem has been detected, the placeholders are populated with the actual values and results, as shown in this example payload:</p>
<pre><code class="language-javascript hljs">{
<span class="hljs-string">&quot;ImpactedEntities&quot;</span>: [
{<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;HOST&quot;</span>, <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;MyHost1&quot;</span>, <span class="hljs-string">&quot;entity&quot;</span>: <span class="hljs-string">&quot;HOST-XXXXXXXXXXXXX&quot;</span> },
{<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;SERVICE&quot;</span>, <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;MyService1&quot;</span>, <span class="hljs-string">&quot;entity&quot;</span>: <span class="hljs-string">&quot;SERVICE-XXXXXXXXXXXXX&quot;</span>}
],
<span class="hljs-string">&quot;ImpactedEntity&quot;</span>: <span class="hljs-string">&quot;MyHost1, MyService1&quot;</span>,
<span class="hljs-string">&quot;PID&quot;</span>: <span class="hljs-string">&quot;99999&quot;</span>,
<span class="hljs-string">&quot;ProblemDetailsHTML&quot;</span>: <span class="hljs-string">&quot;&lt;h1&gt;Dynatrace problem notification test run details&lt;/h1&gt;&quot;</span>,
<span class="hljs-string">&quot;ProblemDetailsJSON&quot;</span>:
{<span class="hljs-string">&quot;ID&quot;</span> : <span class="hljs-string">&quot;99999&quot;</span> }
,
<span class="hljs-string">&quot;ProblemID&quot;</span>: <span class="hljs-string">&quot;999&quot;</span>,
<span class="hljs-string">&quot;ProblemImpact&quot;</span>: <span class="hljs-string">&quot;INFRASTRUCTURE&quot;</span>,
<span class="hljs-string">&quot;ProblemTitle&quot;</span>: <span class="hljs-string">&quot;Dynatrace problem notification test run&quot;</span>,
<span class="hljs-string">&quot;Problem URL&quot;</span>: <span class="hljs-string">&quot;https://example.com&quot;</span>,
<span class="hljs-string">&quot;State&quot;</span>: <span class="hljs-string">&quot;OPEN&quot;</span>,
<span class="hljs-string">&quot;Tags&quot;</span>: <span class="hljs-string">&quot;testtag1, testtag2&quot;</span>
}
</code></pre>
<p><strong>Note</strong>: <code>ImpactedEntities</code> and <code>ProblemDetailsJSON</code> are JSON data types and must not have quotes around them.</p>
Mon, 18 Feb 2019 08:24:20 +0100https://www.dynatrace.com/support/help/setup-and-configuration/integrations/third-party/problem-notification/webhook-integration/?updated=mon-18-feb-2019-08-24-20-0100
https://www.dynatrace.com/support/help/setup-and-configuration/integrations/third-party/problem-notification/webhook-integration/