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

Retrieve all host group names in the environment via APIs


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?






DynaMight Legend
DynaMight Legend

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: 




DynaMight Pro
DynaMight Pro

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:


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)


5) Enter 


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  -outfile hostgroup_06092021.csv

C:\dynatrace-pwsh-master\get-tenantHostGroupDetail.ps1 | format-table

C:\dynatrace-pwsh-master\get-tenantHostGroupDetail.ps1 -token dt0c01.xxxxxxxx -dtenv  -summary



DynaMight Pro
DynaMight Pro

See also Product Idea Host group visualization in side bar - Dynatrace Community

Kind regards, Frans Stekelenburg                 Certified Dynatrace Associate |, Dynatrace Partner

Featured Posts