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
09-06-2019 04:46 PM
I have an HTTP template that does not have some of the predefined variable completed when posts happen. Here is an example. Many of them work fine but others do not. Any advice or guides on how to do this? I have exhausted the documentation on this. One of them is {latestEvent.deepLink} which comes back as null all the time. In addition {latestEvent.node.name} seems to never be completed either. Thanks.
Template (actual obfuscated data below it as integrated)
{
"incident_key": "${latestEvent.node.name} - ${latestEvent.application.name}",
"description": "${latestEvent.displayName} on ${latestEvent.application.name}",
"client": "AppDynamics",
"client_url": "${controllerUrl}",
"details": {
"Event Name": "${latestEvent.displayName}",
"Summary": "${latestEvent.summaryMessage}",
"Event ID": ${latestEvent.id},
"GUID": "${latestEvent.guid}",
"Event Time": "${latestEvent.eventTime}",
"Event Type": "${latestEvent.eventType}",
"Event Type Key": "${latestEvent.eventTypeKey}",
"Application Name": "${latestEvent.application.name}",
"Node Name": "${latestEvent.node.name}",
"Message": "${latestEvent.eventMessage}",
"Severity": "${latestEvent.severity}"
},
"contexts":[
{
"type": "image",
"src": "${latestEvent.severityImage.deepLink}",
"alt": "${latestEvent.severity}"
},
{
"type": "link",
"href": "${latestEvent.deepLink}",
"text": "View this transaction in AppDynamics"
}
]
}
Here is an actual integrated sample of an actual POST
{
"incident_key": "${latestEvent.node.name} - xxx Company",
"description": "Health Rule State changed from Critical to Warning on xxx Company",
"client": "AppDynamics",
"client_url": "https://abcd.saas.appdynamics.com",
"details": {
"Event Name": "Health Rule State changed from Critical to Warning",
"Summary": "AppDynamics has detected a problem with Business Transaction abc downgraded in severity and is now <b>warning</b>.",
"Event ID": "3399999093",
"GUID": "4c2cb73f-1791-461d-9848-x78fa10d17a7",
"Event Time": "Fri Sep 06 15:33:55 PDT 2019",
"Event Type": "POLICY_DOWNGRADED",
"Event Type Key": "Health Rule",
"Application Name": "xxx Company",
"Node Name": "${latestEvent.node.name}",
"Message": "AppDynamics has detected a problem with Business Transaction abc downgraded in severity and is now <b>warning</b>.<br>All of the following conditions were found to be violating<br>For Application <b>xxx Company</b>:<br>1) Errors<br><b>Errors per Minute's</b> value <b>21.00</b> was <b>greater than</b> baseline-based calculated value <b>8.00</b> by <b>2.00</b> standard deviation(s) <b>4.94</b>. Baseline used here is '<b>Weekly Trend - Last 3 months</b>' for the last <b>9</b> minutes<br>2) Calls<br><b>Errors per Minute's</b> value <b>21.00</b> was <b>greater than</b> the threshold <b>1.00</b> for the last <b>9</b> minutes<br>3) Error Percentage<br><b>Error Percentage's</b> value <b>23.00</b> was <b>greater than</b> the threshold <b>10.00</b> for the last <b>9</b> minutes<br>",
"Severity": "WARN"
},
"contexts": [
{
"type": "image",
"src": "https://abcd.saas.appdynamics.com/images/PI_WARNING_small.png",
"alt": "WARN"
},
{
"type": "link",
"src": null,
"alt": null
}
]
}
09-12-2019 11:41 AM - edited 09-12-2019 11:44 AM
I'm no expert, but I've fiddled around with some e-mail templates using the predifined variables, the language they're using is called "Apache Velocity" so you can google that and find out more about how the syntax should work. You need to "set" the variables first and then call them later. We have an email template in place which uses something like the code shown below. (so maybe you can extrapolate from there? Code may be a bit off because the message boards strip html) You also need to ensure your deeplinks are set correctly in your domain.xml file on your controller (see here: https://community.appdynamics.com/t5/Knowledge-Base/How-do-I-modify-the-deep-link-URL-in-alert-email...). Also be sure to use the "test" feature to make sure you got it right :
Subject: $subject
09-12-2019 12:59 PM - edited 09-12-2019 01:27 PM
We are on the SaaS offering and I am looking only at the built in variables for the HTTP template. Thanks for the note on Apache Velocity. If you can help me troubleshoot the controller-based deepLink to the latestEvent object that would be great.
09-12-2019 01:19 PM
Because of the code, my posts keep getting marked as SPAM and automatically deleted. So I'll be brief:
My advice is to practice with an "email template" first. It has a really good "Test" function which allows you to play around with the code, trigger a condition, and then get an email on it showing you what it'll look like, while also checking for syntax errors. Then I'd move it into the HTTP Requests from there. Your go to document for which variables you can call is this: https://docs.appdynamics.com/display/PRO45/Predefined+Templating+Variables
It's a small list of variables, I know, so you have to get really creative, such as trying to strip the variables out of the deeplink or out of the message summary if possible. For syntax help, you can go to the Apache velocity site for help: http://velocity.apache.org/
I would start small with just displaying something like the summary message and deeplink, and then add on one at a time from there. deeplink should just be ${latestEvent.deepLink} and summary should be ${latestEvent.summaryMessage} (they're case sensetive)
It's a very limited language, so it may be that you are unable to pull the exact variable you want. Remember to use the #set function to build out your strings if possible. I wish you way more than luck!
09-12-2019 01:28 PM
Thank you so much for the reply! I will check out the velocity site and will get with AppD support on our controller support. Cheers! Doug
09-13-2019
02:16 PM
- last edited on
08-04-2021
01:36 PM
by
Claudia.Landiva
I checked our spam filter and have since removed @Eric.Miller's post from spam so you can see his original post up in the conversation list. That may provide some more insight.
Best,
Thanks,
Ryan, Cisco AppDynamics Community Manager
Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.
Check out Observabiity in Action
new deep dive videos weekly in the Knowledge Base.
07-03-2020 01:03 AM - last edited on 07-06-2020 10:11 AM by Ryan.Paredez
08-03-2021 11:46 PM
Hey Eric,
Thanks you for sharing details. I'm facing a similar issue where my description is coming in HTML and need to format it in plain text. We have a SaaS Controller and I'm unsure where I can use this below script to replace HTML tags.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form