Hi Team,
I am trying to get monthwise availaibity metrics of synthetics monitors using Synthetic API, but in response, am getting timestamps in UNIX format. Is there is way to get it in DD-MM-YY format or human understandable format?
Solved! Go to Solution.
Hey Balamurugesh,
If you request the data in CSV format you will get get a date/time format as seen in my screenshot below.
My example query looks like the following.
The docs for querying metrics can be found below with an example for the CSV format at the bottom.
https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/get-data-points#tabgr...
Unfortunately I can't see a way to request the time in a date/time format when getting a response in json.
thanks for the details. When i query metrics API, am getting monitor Id's in response. Is there a way to get monitorName instead of monitorId in response?
If you have a look at the screenshots I posted you can get the name by adding :names to your metric query. As you can see in the CSV response for my query the name of my http monitor is Recipe API.
hi Fin, I have tied each synthetic monitor with respective application. Am looking for application name as well in response. Is there a way to get the tied Application name in response?
Regards,Dingu
If you tied the application name to the synthetic with tags, as far as I can tell that isn't possible without making another request to get the details on the synthetic in question. Using the returned synthetic ID you can query the synthetic API to get all details including tags.
https://www.dynatrace.com/support/help/dynatrace-api/environment-api/synthetic/synthetic-monitors/ge...
Below is an example
Is there any possibility to get the application details in metrics API call?
Not that I can find unfortunately unless you used a synthetic naming scheme that used the applications name since the synthetic name is provided in the query response.
hi Fin,
I am using below curl request to pull synthetic monitors availability metrics for a month.
curl -X GET "https://abc.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.availabili..." -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token apiKey"
When i run this query today, am getting data for march month. what should i update in the query to get previous month (FEb month)availability data?
Thanks,
bala
Hey Bala,
You need to modify the timeframe selector in your query. There is a cheat sheet for it in DT when you expand the selector input. I would suggest reading into the examples in there as well as looking into the docs as it's very useful for building out complex dashboards and reports relying on the API.
What you're looking for is "&from=now-1M/M&to=now/M" which specifies from now minus 1 month, then rounding to the nearest month. Then it goes to now rounded to the nearest month. So it would round from the beginning of Feb to the beginning of March.
No! currently there is no way you can get that response change from api. You can use a post processor script.
Also check this solution if helps
RFE in place RFE - Dynatrace API can specific timezone using relative timeframe parameters - Dynatrace Community