cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynatrace API to get Availability metrics report and RUM details

Balamurugesh
Contributor

Hi Team,

I am looking for an API which will provide following detials,

 

1. Availability metrics Report for all monitors or applications configured in Dynatrace

2. Real User Metrics 

 

Thanks,

Balamurugesh

6 REPLIES 6

JamesKitson
Dynatrace Guru
Dynatrace Guru

There is no API for that type of reporting, the only 'report' focused API is for managing the configuration of report subscriptions: https://www.dynatrace.com/support/help/how-to-use-dynatrace/dashboards-and-charts/dashboards/subscri...

 

What you can make use of though is the Metrics V2 API to read metric data (all metrics chartable in Dynatrace are available) and feed that to a reporting tool or build reporting off of that some other way.

 

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2

 

hi James, I got to know that i will be able to get the synthetic monitors availability metrics using metric Query API. But i am not sure what values i have to pass in resolution and time frame. I am looking for availability metrics for all monitors in a particular week/month/year

 

it would be great if you can provide a sample curl command which will give synthetic monitors availability metrics for an week/month/year.

If you haven't used it before I would check out and get familiar with the API Explorer in the UI. It makes it easier to play with the endpoints and fields you send and especially nice is it will also show you what the formatted curl command will look like as an example.

 

As a simple metric selector in the metrics V2 query API:

builtin:synthetic.browser.availability.location.total:splitBy("dt.entity.synthetic_test","dt.entity.geolocation")

 

Place that in the metricSelector field:

JamesKitson_0-1652968748559.png

Run it and at the bottom you should see the resulting json as well as the request that was sent and a curl example:

 

JamesKitson_1-1652968880041.png

 

curl -X GET "https://<dynatrace_hostname>/api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.availability.location.total%3AsplitBy%28%22dt.entity.synthetic_test%22%2C%22dt.entity.geolocation%22%29" -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token <token_with_proper_permissions>"

James, may i know why you are passing "AsplitBy%28%22dt.entity.synthetic_test%22%2C%22dt.entity.geolocation%22%2"

 

in metric selector? I am using below query to get availability metrics from a management zone,

curl --location --request GET
'https://dynatrace.com/e/abc/api/v2/metrics/query?metricSelector=%22builtin%3Asynthetic.http.availabi...' \
--header 'accept: application/json; charset=utf-8' \

 

is there a way to pass multiple managementzones and monitor types in a single request? Also i was asked to use merge transformation in query to get the exact metrics like it shows in dynatrace APP. can you explain how to pass merge transformers in above query as well?

 

 

 

I was just using a basic metric selector to show all test availability split by test name and location. You have a lot of control over how the data is filtered, organized, and aggregated using the metric selectors. I would read through their documentation to get familiar with what is possible. The API also has an entitySelector field where you can apply additional filters on top of the query to limit which entities (e.g. synthetic tests) are included when querying.

 

You can try these entity selectors first to test and make sure you get the data you want in the Data Explorer using the 'code' tab as well. Once you get it working you can plug the query into the API.