# Get a list of all host-group names from the environment

**URL:** <https://community.dynatrace.com/t/get-a-list-of-all-host-group-names-from-the-environment/20806>\
**Category:** Open Q&A\
**Tags:** management-zones, account-management, dynatrace-saas\
**Created:** [November 14, 2020, 5:52am UTC](https://community.dynatrace.com/t/get-a-list-of-all-host-group-names-from-the-environment/20806 "2020-11-14T05:52:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [November 14, 2020, 5:52am UTC](https://community.dynatrace.com/t/get-a-list-of-all-host-group-names-from-the-environment/20806/1 "2020-11-14T05:52:44Z")

</div>

Hello Folks,

We have defined some management zones in our environments based on rule “Host-Group” name exists.

Now, we want to replicate the same on other environment and the challenge is, we are able to fetch the host-group entity ID (via API) but not the actual name of host-groups.

How can we get a list of all host-group names from the environment?

Regards,

AK

---

<div class="post-metadata">

**Author:** ![khoros\_anonymous](https://avatars.discourse-cdn.com/v4/letter/k/f9ae1b/32.png) [@khoros\_anonymous](https://community.dynatrace.com/u/khoros_anonymous)\
**Post date:** [November 14, 2020, 6:59am UTC](https://community.dynatrace.com/t/get-a-list-of-all-host-group-names-from-the-environment/20806/2 "2020-11-14T06:59:34Z")

</div>

You should be able to query all the OneAgents API (/api/v1/oneagents) and extract the HostGroup Object: [OneAgent on a host - GET a list of hosts with OneAgent details — Dynatrace Docs](https://www.dynatrace.com/support/help/shortlink/api-oneagent-on-host#oneagents-get-response-hostgroup)

Name → “The name of the Dynatrace entity, displayed in the UI”

```auto
"hostGroup": {          

```

The name doesn’t show anything?

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [November 14, 2020, 7:32am UTC](https://community.dynatrace.com/t/get-a-list-of-all-host-group-names-from-the-environment/20806/3 "2020-11-14T07:32:51Z")

</div>

Yes it worked. Thanks Dante P. for attention to the query and quick response.

---

<div class="post-metadata">

**Author:** ![r\_weber](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/r_weber/32/24884_2.png) [@r\_weber](https://community.dynatrace.com/u/r_weber)\
**Post date:** [November 16, 2020, 7:51pm UTC](https://community.dynatrace.com/t/get-a-list-of-all-host-group-names-from-the-environment/20806/4 "2020-11-16T19:51:43Z")

</div>

Hi Akshay,

actually in version 1.205 (even before) you will find the hostgroup identifier and name on the entity V1 API endpoint as well.

/e/\<tenantid\>/api/v1/entity/infrastructure/hosts

 ![27318-1605556294383.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/2/a2e844e540d1c375b234a288256f07af03f8852b.png)

Reinhard

---

<div class="post-metadata">

**Author:** ![fstekelenburg](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/fstekelenburg/32/22029_2.png) [@fstekelenburg](https://community.dynatrace.com/u/fstekelenburg)\
**Post date:** [February 28, 2023, 10:31am UTC](https://community.dynatrace.com/t/get-a-list-of-all-host-group-names-from-the-environment/20806/5 "2023-02-28T10:31:44Z")

</div>

See also Product Idea&nbsp;[Host group visualization in side bar - Dynatrace Community](https://community.dynatrace.com/post/170138)
