09 Jun 2021 07:09 PM - last edited on 29 Jun 2021 01:56 PM by MaciejNeumann
I need to use some Dynatrace APIs to retrieve a list of all host groups names configured in our environment,
i do not have host group ids and i do not want to retrieve a single host or host group, simply a full list of ALL distinct host groups names, and their ids in case host groups also have IDs.
what is the easiest set of APIs to use to retrieve this list?
Thanks,
Davide
Solved! Go to Solution.
09 Jun 2021 07:49 PM
You can do this via the API:
I recommend saving the API Json then importing it to excel where you then can remove unwanted data:
10 Jun 2021 03:59 AM
I have an equally good solution. Someone had created an amazing set of powershell scripts to also extract administrative type data out of DT. The Git Repo is here: https://github.com/mzball-dt/dynatrace-pwsh
Note: Each script has a helpful header that tells you what permissions the token requires, the parameters you can pass in, and some example runs
First create a token with the proper access to run the script. You'll need it in Step 5
Steps for DT SaaS. If you use Managed then follow the instruction in the Git repo.
1) downloaded and extract the zip
2) Open a powershell prompt (e.g. C:\dynatrace-pwsh-master)
3) navigate to the directory you extracted the code into
4) Enter (replace xxxxx with your SaaS tenant id)
$env:dtenv='https://xxxxxxxxx.live.dynatrace.com';
5) Enter
$env:dttoken='dt0c01.XXXXXXXXXXX';
6) Enter this command and enter 'Y'. This changes the execution policy so that you can run third-party scripts.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass;
7) Run any of the scripts you like.
Here are example commands I use frequently to get the data
C:\dynatrace-pwsh-master\get-tenantHostGroupDetail.ps1 -token dt0c01.xxxxxx -dtenv https://xxxxx.live.dynatrace.com -outfile hostgroup_06092021.csv
C:\dynatrace-pwsh-master\get-tenantHostGroupDetail.ps1 | format-table
C:\dynatrace-pwsh-master\get-tenantHostGroupDetail.ps1 -token dt0c01.xxxxxxxx -dtenv https://xxxxxxx.live.dynatrace.com -summary
28 Feb 2023 10:31 AM
See also Product Idea Host group visualization in side bar - Dynatrace Community