01 Jul 2020 10:13 AM
Hello,
Here is the situation - we have Dynatrace Managed with a number of (in dozens and hundreds) of different monitored environments.
I would like to make an API call to find out if all or subset of these environments (selected from a list) logged the specific type of alert during a specific timeframe.
For example - list all environments experienced 'slow disk' alerts on the specific day with a timestamp of start/stop of the alert.
How can I do the above using a single request?
I know how to query a specific environment for all/specific types of alerts using GET -
/api/v1/events
But as I said - I have hundreds of such environments and it would require to create access token for each environment and query each of them separately. This is not a practical solution.
Any alternatives?
Thanks
Solved! Go to Solution.
01 Jul 2020 10:41 AM
There is no such option to query multiple environments. You will have to get Api Token for each one and query them individually.
Luckily, you should be able to automate this using the Cluster API v2. I did not try this yet on my own, but you should be able to create a token management token for each environment and then create the required API token for each environment.
01 Jul 2020 11:12 AM
I just looked at cluster API v2. I See
Manage environments
Migration to multi-datacenter deployment
Manage remote access requests
Manage synthetic locations and nodes
Manage Dynatrace API authentication tokens
Manage user sessions
How above is going to help me? One way or another, I need to create a token for each environment and then using that token query alerts. Nothing has changed, in terms of reducing time to get my answers, right?
Thanks
01 Jul 2020 11:16 AM
Julius and I meant "Tokens" API that can be used to create automatically tokens for each environment. See my github example.
For the specific operation you should look at the Environment's APIs.
01 Jul 2020 11:30 AM
OK, folks, thank you both.
Seems I need to take the path of Ansible/bash scripting way...
01 Jul 2020 11:13 AM
01 Jul 2020 11:15 AM
OK - moved.
01 Jul 2020 10:46 AM
Hi Irakli - take a look at my example here that I show how I update Frequent Issues Detection settings for many environments using Ansible:
You cannot do that with a single call, but that's not bad when you automate that - you can call single... script.
01 Jul 2020 11:09 AM
I am kinda surprised that such a feature is not implemented...
Let me try your approach but in one of our clusters we have '2047 Environments' (not a joke) and I can imagine how much time will it take to go thru all of them.
The problem with the script that in it could be 15 from 2000 environments which experience such alert type but unless I query all of them, I won't be able to see which one was...
01 Jul 2020 11:14 AM
It's intentionally not implemented. The way we store separately data per environment, server would need to run the workload of iterating of hundreds or thousands of envs. You rather don't want to overload server with a single query, but rather run smaller chunks and throttle requests if it's too much...
BTW - what I guess you try to do is to implement some custom alerting on top of what Dynatrace does with AI. We work for better customization possibilities in that area - we'll see what next year brings.
Anyway... 2000+ envs it pretty too much, but you probably already know that 😉