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 06-05-2020 10:02 AM - edited on 05-06-2024 03:28 PM by Ryan.Paredez
AppDynamics Metrics and Snapshots API can be easily called programmatically.
If you want to get Time Series/Metrics data from Microsoft Power BI, first consider whether you want to retrieve it directly via API, or indirectly through a batch process such as Entity Metrics Report in Power BI.
NOTE: Power BI is only available for Windows.
This article focuses on how to retrieve Time Series/Metrics data directly via API.
To learn how to take the next steps of visualizing and publishing this data in Power BI, see How do I display and publish metrics data with Microsoft Power BI? Part 2.
http://yourcontrollerhost.maybeonsaas.com/controller/rest/applications/ECommerce/metric-data?metric-path=Overall%20Application%20Performance%7CCalls%20per%20Minute&time-range-type=BEFORE_NOW&duration-in-mins=60
http://yourcontrollerhost.maybeonsaas.com/controller/rest/applications/ECommerce/metric-data?metric-path=Overall%20Application%20Performance%7CCalls%20per%20Minute&time-range-type=BEFORE_NOW&duration-in-mins=60
"metric-path=Overall Application Performance|Calls per Minute" |
specifies metric path |
"time-range-type=BEFORE_NOW" |
specifies that the measuring is going from NOW back some time range. Other values can be "BETWEEN_TIMES" |
"duration-in-mins=60" |
specifies how many minutes to go back from BEFORE_NOW |
"output=json" |
specifies that the API should return data formatted as JSON object |
"rollup=false" |
specifies that all metric values should be returned |
Use your favorite tool—such as cURL, Wget, PowerShell, or Postman—to test the query. Below, it’s being tested in Postman and clearly returns some nice data:
Congratulations! You have data from AppDynamics as a JSON document. You can't do much with it yet, though. Next, you must massage it into something you can graph.
Name |
Type |
Value |
ApplicationNameOrID |
String |
[Name or ID of your Application] |
MetricPath |
String |
Overall Application Performance|Calls per Minute |
NumberOfMinutes |
String |
60 |
You’ll be able to modify these parameters later.
Part Type |
Value |
Text |
http[s]://<yourcontroller>/controller/rest/applications/ |
Parameter |
ApplicationNameOrID |
Text |
/metric-data?metric-path= |
Parameter |
MetricPath |
Text |
&time-range-type=BEFORE_NOW&duration-in-mins= |
Parameter |
NumberOfMinutes |
Text |
&output=json&rollup=false |
http://yourcontrollerhost.maybeonsaas.com/controller/rest/applications/{ApplicationNameOrID}/metric-data?metric-path={MetricPath}&time-range-type=BEFORE_NOW&duration-in-mins={NumberOfMinutes}&output=json&rollup=false
Click OK
Click Close
Click the Home\Query\Refresh Preview button on the ribbon
=#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [startTimeInMillis]/1000)
Repeat these steps for all other columns you have a need for, like "sum", "count", "min", "max" and "standardDeviation".
You are done! The resulting dataset is a thing of beauty.
Your final query for GetMetricData in Power Query M language should look like this:
let
Source = Json.Document(Web.Contents("http://demo2.appdynamics.com/controller/rest/applications/" & ApplicationNameOrID & "/metric-data?metric-path=" & MetricPath & "&time-range-type=BEFORE_NOW&duration-in-mins=" & NumberOfMinutes & "&output=json&rollup=false")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"metricId", "metricName", "metricPath", "frequency", "metricValues"}, {"metricId", "metricName", "metricPath", "frequency", "metricValues"}),
#"Expanded metricValues" = Table.ExpandListColumn(#"Expanded Column1", "metricValues"),
#"Expanded metricValues1" = Table.ExpandRecordColumn(#"Expanded metricValues", "metricValues", {"startTimeInMillis", "occurrences", "current", "min", "max", "useRange", "count", "sum", "value", "standardDeviation"}, {"startTimeInMillis", "occurrences", "current", "min", "max", "useRange", "count", "sum", "value", "standardDeviation"}),
#"Added Custom" = Table.AddColumn(#"Expanded metricValues1", "EventTime", each #datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [startTimeInMillis]/1000)),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"EventTime", type datetime}, {"value", Int64.Type}})
in
#"Changed Type"
To visualize and publish your data using Microsoft Power BI, you will need the PBIX file you saved in Step 11, above.
Go to How do I display and publish metrics data with Microsoft Power BI? - Part 2 for the step-by-step instructions.
To learn how to take the next steps of visualizing and publishing this data in Power BI, see How do I display and publish metrics data with Microsoft Power BI? Part 2.
Hi,
Is there a way to pull all metrics?
The reason is that I need to be able filter all metrics with "No data to display" for all the applications we have.
Regards,
Khalid
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form