Cisco AppDynamics is an Application Performance Management (APM) tool that allows you to monitor the performance of your applications. Often in operations, it can be difficult to trace where the problem is. Is it the network? Is it the application? Is it the database? AppDynamics uses agents to monitor application transactions and resources to give you the data you need to know where the bottlenecks are taking place.
AppDynamics is a tool that provides feedback based on monitoring an application, so the most useful demonstrations of it require an application to monitor. Cisco DevNet has a free and reservable sandbox, the AppDynamics DevNet Sandbox. In order to have the APIs be effective in seeing data, and to get an instance of AppDynamics to play with and use its APIs, you will need to complete the first four steps of the Java Application Monitoring Fundamentals lab. This will give you a Java application to monitor and the data to use in the API calls.
The full documentation for the AppDynamics APIs is very thorough and can be found here.
After you have completed the first four steps and gotten the sandbox up and running for AppDynamics, it is time to create your API clients to generate an OAuth token to log in to the API.
The following steps require you to be on the sandbox VPN and logged into the Main Controller UI with the credentials admin/welcome1
:
admin
with the password welcome1
.cisco u
; you can ignore the Description field.Note: This API client secret acts as a password. It does not generate the authentication token.
Note: In an actual production environment, for security reasons, you would not want to give a user access to all roles.
While on the VPN, you can verify that the token is working by issuing the following command (inserting your token):
~$ curl --location --request GET 'http://10.10.20.2:8090/controller/rest/applications' \
> --header 'Authorization: Bearer
YOUR TOKEN PASTED HERE'
If the token is successful, you will get a list of the business applications in the AppDynamics system. We will use the application name in future API calls.
~$ curl --location --request GET 'http://10.10.20.2:8090/controller/rest/applications' \
> --header 'Authorization: Bearer eyJraWQiOiJiNTQ3ZjY5ZC1mMTUxLTRjY2ItYjc0MC0yOWMzYzgzZWEwMmYiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJBcHBEeW5hbWljcyIsImF1ZCI6IkFwcERfQVBJcyIsImp0aSI6InB2Q2Z3UGFZaHJtSzVWQTRJbkl1aGciLCJzdWIiOiJjaXNjbyB1IiwiaWRUeXBlIjoiQVBJX0NMSUVOVCIsImlkIjoiMDdjZDAyNmItN2JlMi00OWQwLTljMmItYmU1OTgyYTkxMGFmIiwiYWNjdElkIjoiYjU0N2Y2OWQtZjE1MS00Y2NiLWI3NDAtMjljM2M4M2VhMDJmIiwidG50SWQiOiJiNTQ3ZjY5ZC1mMTUxLTRjY2ItYjc0MC0yOWMzYzgzZWEwMmYiLCJhY2N0TmFtZSI6ImN1c3RvbWVyMSIsInRlbmFudE5hbWUiOiIiLCJmbW1UbnRJZCI6bnVsbCwiYWNjdFBlcm0iOltdLCJyb2xlSWRzIjpbXSwiaWF0IjoxNzAwNTIwMTAyLCJuYmYiOjE3MDA1MTk5ODIsImV4cCI6MTcwMDYwNjUwMiwidG9rZW5UeXBlIjoiQUNDRVNTIn0.Wtt_nnA7NreYz2cvqZUGKDf5WfEQu4VHXwWBbaGQ88U'
The following is sample output, listing all the applications:
<applications><application>
<id>10</id>
<name>Supercar-Trader</name>
<accountGuid>b547f69d-f151-4ccb-b740-29c3c83ea02f</accountGuid>
</application>
</applications>~$
Now that you have gotten your authentication working, there are a few other details to be aware of regarding the AppDynamics REST API.
http://<controller_host>:<controller_port>/controller/rest/<REST_URI>
?output=JSON
) as follows:curl --location --request GET 'http://10.10.20.2:8090/controller/rest/applications'?output=JSON \
--header 'Authorization: Bearer
YOUR TOKEN'
[{
"name": "Supercar-Trader",
"description": "",
"id": 10,
"accountGuid": "b547f69d-f151-4ccb-b740-29c3c83ea02f"
}]
In the previous step, to verify that our token was working correctly, we already invoked the Retrieve All Business Applications
API call:
GET /controller/rest/applications
This API call was used to get the name of our application, Supercar-Trader
, which we will use in the following steps looking at other Application Model APIs.
Next, we are going to modify the path, including the name of the application (Supercar-Trader
), to get all the business transactions from that application. The generic path from the docs is as follows:
GET /controller/rest/applications/application_name/business-transactions
Using your own token, modify your path and then paste in the new curl request similar to what I have here, with your own token:
curl --location --request GET 'http://10.10.20.2:8090/controller/rest/applications/Supercar-Trader/business-transactions'?output=JSON --header 'Authorization: Bearer YOUR TOKEN'
You should get a response like this:
[
{
"internalName": "ActionHome.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionHome.execute",
"id": 55,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "/Supercar-Trader/home.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/home.jsp",
"id": 56,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/sell.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/sell.jsp",
"id": 57,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/car.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/car.jsp",
"id": 58,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "ActionSell.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionSell.execute",
"id": 59,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "ActionCar.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionCar.execute",
"id": 60,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "/Supercar-Trader/thanks.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/thanks.jsp",
"id": 61,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/search.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/search.jsp",
"id": 62,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "ActionCars.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionCars.execute",
"id": 63,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "/Supercar-Trader/insurance.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/insurance.jsp",
"id": 64,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "ActionInsurance.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionInsurance.execute",
"id": 65,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "ActionInventory.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionInventory.execute",
"id": 66,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "/Supercar-Trader/inventory.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/inventory.jsp",
"id": 67,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/cars.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/cars.jsp",
"id": 68,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "ActionEnquire.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionEnquire.execute",
"id": 69,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "/Supercar-Trader/enquire.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/enquire.jsp",
"id": 70,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/about.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/about.jsp",
"id": 71,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "ActionAbout.execute",
"tierId": 14,
"entryPointType": "STRUTS_ACTION",
"background": false,
"tierName": "Web-Portal",
"name": "ActionAbout.execute",
"id": 72,
"entryPointTypeString": "STRUTS_ACTION"
},
{
"internalName": "/Supercar-Trader/sell.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/sell.do",
"id": 73,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/car.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/car.do",
"id": 74,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/supercars.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/supercars.do",
"id": 75,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/search.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/search.do",
"id": 76,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/cars.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/cars.do",
"id": 77,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/insurance.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/insurance.do",
"id": 78,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/deleteRecord.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/deleteRecord.jsp",
"id": 79,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/enquire.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/enquire.do",
"id": 80,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/updateRecord.jsp",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/updateRecord.jsp",
"id": 81,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/about.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/about.do",
"id": 82,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "/Supercar-Trader/home.do",
"tierId": 14,
"entryPointType": "SERVLET",
"background": false,
"tierName": "Web-Portal",
"name": "/Supercar-Trader/home.do",
"id": 83,
"entryPointTypeString": "SERVLET"
},
{
"internalName": "_APPDYNAMICS_DEFAULT_TX_",
"tierId": 14,
"entryPointType": "POJO",
"background": false,
"tierName": "Web-Portal",
"name": "_APPDYNAMICS_DEFAULT_TX_",
"id": 84,
"entryPointTypeString": "POJO"
}
]~$
Sometimes, you want to see all the tiers in an application. This API call is similar to the last one, using the application name, but now with /tiers
at the end:
GET /controller/rest/applications/application_name/tiers
Your command should look like this:
~$ curl --location --request GET 'http://10.10.20.2:8090/controller/rest/applications/Supercar-Trader/tiers'?output=JSON --header 'Authorization: Bearer YOUR TOKEN'
Your output should look like this:
[
{
"agentType": "APP_AGENT",
"name": "Web-Portal",
"description": "",
"id": 14,
"numberOfNodes": 1,
"type": "Application Server"
},
{
"agentType": "APP_AGENT",
"name": "Api-Services",
"description": "",
"id": 15,
"numberOfNodes": 1,
"type": "Application Server"
},
{
"agentType": "APP_AGENT",
"name": "Inventory-Services",
"description": "",
"id": 16,
"numberOfNodes": 1,
"type": "Application Server"
},
{
"agentType": "APP_AGENT",
"name": "Insurance-Services",
"description": "",
"id": 17,
"numberOfNodes": 1,
"type": "Application Server"
},
{
"agentType": "APP_AGENT",
"name": "Enquiry-Services",
"description": "",
"id": 18,
"numberOfNodes": 1,
"type": "Application Server"
}
]
We are not going to walk through every API call in AppDynamics, but through these examples, you should get a feel for what the process looks like.
You have completed this tutorial, advancing in your learning journey. To continue building your networking skills, check out our additional tutorials, courses, and learning paths.
A Cisco U. account helps you:
Personalize training: Set your learning goals and pace.
Track progress: Monitor your achievements and learning milestones.
Resume anytime: Continue your learning exactly where you stopped.
Explore More on Cisco U.:
To ask questions and share ideas, join our Cisco Learning Community.
For technical issues, feedback, or more resources, visit our Cisco U. Support page.
Don’t forget to click Exit Tutorial to log your completed content.