This page describes the predefined variables that can be used in an HTTP request template or in an email template. The policy engine substitutes the value of the variable in the context of the triggering event(s) when it sends the actual request or email.

Form Variable Names

To form a predefined variable name, combine the base name of the variable with a field of its corresponding info class. You can use the base name with the corresponding info class only for example, you can use the base name action with info class ActionInfo only.

If an info class has no fields associated, use the base name as the variable. For example, to use the controller URL as a variable in a template, use ${controllerUrl}.

If an info class comprises multiple fields, select a single field and associate it with the base name. For a list of fields associated with an info class, see Info Class Fields.

For example:

  • To use the account name as a variable in a template, combine the base name account with the name field of the EntityInfo class to form the variable ${}.
  • To use the trigger time of an action as a variable, combine the base name action with the triggerTime field of the ActionInfo class to form the variable ${action.triggerTime}.

You can chain the segments of a variable name where the info class field type is yet another info class.

For example, to use the name of an application in which the latest triggering event occurred:

  1. Combine the latestEvent base name with the application field of the EventInfo class.
  2. The field type of the application field is EntityInfo which is yet another info class, hence select the name field of the EntityInfo class.
  3. Form the variable name by appending the segments:

    { <base name>.<field name of info class1>.<field name of info class2>}


Base Names

This tables describes the base names for the predefined variables with their corresponding info classes.

Base NameDescriptionInfo Class
accountAccount in which the action was triggered.EntityInfo
policyPolicy that triggered the action.PolicyInfo
actionTriggered action.ActionInfo
topSeverityINFO, WARN or ERROR.NotificationSeverity
topSeverityImageSeverity image or icon.ImageInfo
notificationConfigTextEmail actions only.String
controllerUrlURL of the controller.String
latestEventMost recent triggering event.EventInfo
fullEventListList of events that triggered the action.List<EventInfo>
fullEventsByTypeMapList of events that triggered the action, grouped by type.Map<String, List<EventInfo>>
clampLimitOptional setting, limit on how many triggering events to display.
clampedTrue if clamp limit is set.boolean
clampedEventListn most recent triggering events if clamped.List<EventInfo>
clampedEventsByTypeMapn most recent triggering events if clamped, grouped by type.Map<String, List<EventInfo>>


Node level variables to be used in email and HTTP templates.
Map<EventInfo, NodeTemplateVariables>

Info Class Fields

From the previous Base Names table, use the fields in the appropriate class to form the variable to use in a template.

class EventInfo {
  EventType eventType
  long id
  String guid
  String eventTypeKey
  Date eventTime
  String displayName
  String summaryMessage
  String eventMessage
  EntityInfo application
  EntityInfo tier
  EntityInfo node
  EntityInfo db
  List<EntityInfo> affectedEntities
  boolean healthRuleEvent
  EntityInfo anomaly // * Only defined in case of anomaly event
  EntityInfo healthRule // * Only defined when healthRuleEvent == true
  EntityInfo incident // * Only defined when healthRuleEvent == true
  boolean healthRuleViolationEvent
  NotificationSeverity severity
  ImageInfo severityImage
  boolean btPerformanceEvent // * true when eventType matches one of the BT performance event types
  String deepLink

class ImageInfo {
  String name
  String fileName
  String mimeContentRef
  String deepLink

class EntityInfo { 
  EntityType entityType 
  String entityTypeDisplayName 
  long id 
  String name 

class ActionInfo extends EntityInfo {
 Date triggerTime 

class PolicyInfo extends EntityInfo {
 boolean digest 

class PolicyInfo {
  EntityType entityType
  String entityTypeDisplayName
  long id
  String name
  boolean digest
  int digestDurationInMins

class ActionInfo {
  EntityType entityType
  String entityTypeDisplayName
  long id
  String name
  Date triggerTime
enum NotificationSeverity { INFO, WARN, ERROR }
class NodeTemplateVariables {
    private long id;
    private String name;
    private long tierId;
    private String tierName;
    private long machineId;
    private String machineName;
    private boolean machineAgentPresent;
    private String machineAgentVersion;
    private boolean appAgentPresent;
    private String appAgentVersion;
    private String ipAddresses;
    private AgentType agentType;

The private String ipAddresses field contains hostnames instead of IP addresses.


HTTP request example for most recent triggering event:


HTTP request example iterating through a list of triggering events:

#foreach(${event} in ${fullEventList})

Email with dynamically varying subject example:

If you have several health rules to monitor your application and one policy to send email notification for all the health rules, you might find it difficult to search for the correct information in the notification. You can define a variable to dynamically update the email subject based on the event that triggered the notification. 

Ensure that you define the subject variable in the email body and include it in the subject field.

Subject: $subject
 <!-- Subject changes dynamically based on the triggering event -->
#set($subject = #foreach(${events} in ${fullEventList}) ${events.eventType} #end )}

Email HTML body example:

AppDynamics uses this email template to notify the details of the events occurring on an application. You can customize the required event details you want notified by enabling the event types.

<!-- Default AppDynamics email template -->
#if( $!{notificationConfigText} != '' )
Event Notification for the "${}" Application
Event Notification Name: ${}
Event Notification Severity: ${topSeverity}

Summary of events occurring during the ${policy.digestDurationInMins}+ minute(s) prior to ${action.triggerTime}:
## Summary table
|| Event Type | Count ||
## Copy this row for each event type and count
#foreach($eventTypeEntry in $fullEventsByTypeMap.entrySet())
|| ${eventTypeEntry.getKey()} | ${eventTypeEntry.getValue().size()} ||

## Full List of Events
The following events occurred during the time frame:
#if ($clamped)
Warning: The event list has been clamped at ${clampLimit} results! Please see the event and/or request snapshot viewers for the full list of events.
|| Event Time | Event Type | Severity | Tier | Node | Summary || 

#foreach($eventList in $clampedEventsByTypeMap.values())
  #foreach($event in $eventList)
    || ${event.eventTime} | ${event.displayName} | ${event.severity} | $!{} | $!{} | $!{} | ${event.summaryMessage} ||
Event Notification from AppDynamics.
This is an auto-generated email summarizing events on the "${}" application. You are receiving this because you are configured as a recipient on the "${}" event notification. This is not necessarily an exhaustive list of all events during this time frame. Only those event types enabled in the notification will appear in this message.

Example to extract event details using iteration:

These examples iterate through the eventList to extract the details of each event occurring during the specified time.

<h1>Summary of events occurring during the ${policy.digestDurationInMins}+ minute(s) prior to ${action.triggerTime}:</h1>


#foreach(${eventList} in ${fullEventsByTypeMap.values()})
  #foreach(${event} in ${eventList})

            <!-- Event icon -->
            <img src="${event.severityImage.mimeContentRef}" alt="${event.severity}" />
            <!-- Event name with event link -->
            <a href="${event.deepLink}">${event.displayName}</a>
            <!-- Event message -->



Example code to list all variables:

<h1>variables below </h1>


<h2>map elements below</h2>

#foreach(${value} in ${fullEventsNodeMap.values()})

If these predefined variables do not meet your needs, you can define your own custom variables for use in these templates in the Create Template pane.

Do not use any of the predefined variable names for your custom variables.