Examples
HTTP request example for most recent triggering event:
http://myController:8080/controller/rest/applications/${latestEvent.application.name}/nodes/${latestEvent.node.name}
HTTP request example iterating through a list of triggering events:
#foreach(${event} in ${fullEventList})
http://myController:8080/controller/rest/applications/${event.application.name}/nodes/${event.node.name}
#end
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
Body:
...
<!-- Subject changes dynamically based on the triggering event -->
#foreach(${events} in ${fullEventList})
#set($subject = ${events.eventType.toString()}) #end
...
Email HTML body example:
Splunk 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} != '' )
$!{notificationConfigText}
#else
AppDynamics
#end
Event Notification for the "${latestEvent.application.name}" Application
Event Notification Name: ${policy.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()} ||
#end
## 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.
#end
|| Event Time | Event Type | Severity | Tier | Node | Summary ||
#foreach($eventList in $clampedEventsByTypeMap.values())
#foreach($event in $eventList)
|| ${event.eventTime} | ${event.displayName} | ${event.severity} | $!{event.db.name} | $!{event.tier.name} | $!{event.node.name} | ${event.summaryMessage} ||
#end
#end
Event Notification from AppDynamics.
This is an auto-generated email summarizing events on the "${latestEvent.application.name}" application. You are receiving this because you are configured as a recipient on the "${policy.name}" 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>
<table>
#foreach(${eventList} in ${fullEventsByTypeMap.values()})
#foreach(${event} in ${eventList})
<tr>
<td>
<!-- Event icon -->
<img src="${event.severityImage.mimeContentRef}" alt="${event.severity}" />
</td>
<td>
<!-- Event name with event link -->
<a href="${event.deepLink}">${event.displayName}</a>
</td>
<td>
<!-- Event message -->
${event.eventMessage}
</td>
</tr>
#end
#end
</table>
Example code to list all variables:
You can use the following template to list all variables:
#foreach($eventList in $fullEventsByTypeMap.values())
#foreach($event in $eventList)
|| ${event.eventTime} | ${event.displayName} | ${event.severity} | $!{event.db.name} | $!{event.tier.name} | $!{event.node.name} | ${event.summaryMessage} ||
#end
#end
Example to get all the tags associated with an entity:
You can use the following template to get all the tags associated with an entity:
#foreach(${event} in ${fullEventList})
Event App Name: ${event.application.name}
Event Name: ${event.displayName}
Event HR Name: ${event.healthRule.name}
Event Affected Entities:
#foreach(${affectedEntity} in ${event.affectedEntities})
Affected Entity Name: ${affectedEntity.name}
Affected Entity Type: ${affectedEntity.entityType}
Affected Entity Tags: ${affectedEntity.tagValues}
#end
#end