Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
on
03-29-2019
04:46 PM
- edited on
06-02-2020
03:22 PM
by
Claudia.Landiva
Sample Payloads for HTTP Request Templates
If you create health rule policies that trigger HTTP request actions or email notifications, you can use templates to customize the HTTP request or email message and render specific values when the action is triggered. These templates have a set of predefined variables that are processed using Apache Velocity Engine v1.7.
You can configure custom variables if you need something beyond the predefined ones. This article provides examples of how you can use different Apache Velocity Template variables in HTTP request action and email templates.
The table below describes widely used Velocity variables to help you become more familiar with Velocity when you are customizing templates. A variable consists of a leading “$” followed by an identifier. It should look like this: $foo
Description | Variable |
A custom variable | Usage: $foo |
Set a variable | #set ($message = "Hello") |
If statement |
#if ($message == "Hello") Message received and is "Hello" #end |
Replace HTML tags | #set( $sm = $sm.replace("<b>", "[") ) |
Escape characters | $esc.java(${latestEvent.summaryMessage}) |
Get the first element from an Array/List |
${latestEvent.affectedEntities[0].name} ${latestEvent.affectedEntities[0].entityTypeDisplayName} |
Loop through an Array/List | #foreach( ${entity} in ${latestEvent.affectedEntities} )${entity.name}#if( $foreach.hasNext ),#end#end |
Split | #set ($summary = ${latestEvent.summaryMessage}) #set ($job = $summary.split(" ")) summary: $summary Job: $job[2] Job2: $job.get(2) |
Replace | #set( $sm = $!{latestEvent.summaryMessage.replace('"',"*")} ) #set( $sm = $sm.replace("<b>", "[") ) #set( $sm = $sm.replace("</b>", "]") ) #set( $sm = $sm.replace("<br>", " ") ) |
This article includes a sample HTTP request template payload for Hipchat. To learn about converting event time formats, or creating SMS or Slack alerts, see the resources below.
Is there a template that can be used for splunk?
Hello,
As a prerequisite, please make sure your POST api successfully works
outside AppDynamics UI, using curl / Postman Client / Google Rest client.
The same POST api can be translated within AppDynamics UI- Alert and
Respond -> HTTP Request Template. The variables (link below) will then act
as a placeholder.
You may use any splunk payload used for a POST api, within the "Body"
section of HTTP Request Template, and replace "values" with variables
(below link) for runtime values.
https://docs.appdynamics.com/display/PRO45/Predefined+Templating+Variables
If you need additional information, please create a ticket within the Support Portal. Please note that only Company Admins can open Support tickets.
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form