<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get all process groups in environment? in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238270#M31290</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/21769"&gt;@Dant3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I am automating something so need it for my script to get it via API.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2024 12:15:01 GMT</pubDate>
    <dc:creator>Naveen</dc:creator>
    <dc:date>2024-02-27T12:15:01Z</dc:date>
    <item>
      <title>How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238258#M31284</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to get all the process groups in my environment, I am using below API to get but not getting all the data at once.&lt;/P&gt;&lt;P&gt;&lt;A href="https://{environmentid}.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22PROCESS_GROUP%22%29" target="_blank" rel="noopener"&gt;https://{environmentid}.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22PROCESS_GROUP%22%29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;at one time getting 50 records so is there a way to get all data at once.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 10:30:59 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238258#M31284</guid>
      <dc:creator>Naveen</dc:creator>
      <dc:date>2024-02-27T10:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238262#M31285</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can generate your query from Data Explorer, but you need to select a metric where you can split by process group:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;builtin:tech.generic.count:splitBy("dt.entity.process_group"):sort(value(auto,descending))&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AntonPineiro_0-1709031478500.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17903iA2C4EEEB6617519C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AntonPineiro_0-1709031478500.png" alt="AntonPineiro_0-1709031478500.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Notice default limit has been removed, it shows more than 100 values.&lt;/P&gt;&lt;P&gt;You can try a similar query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -X GET "https://XXXX.live.dynatrace.com/api/v2/metrics/query?metricSelector=(builtin:tech.generic.count:splitBy(\"dt.entity.process_group\"):sort(value(auto,descending))):names&amp;amp;from=-2h&amp;amp;to=now&amp;amp;resolution=Inf"  -H "accept: application/json"  -H "Authorization: Api-Token XXXX-XXXX"&lt;/LI-CODE&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 11:00:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238262#M31285</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2024-02-27T11:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238266#M31287</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/58682"&gt;@AntonPineiro&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I am using powershell to execute but getting below error.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Metric selector parse warning: Metric selectors could&amp;nbsp;only be parsed in backward compatibility mode. Consider&amp;nbsp;querying `(builtin:tech.generic.count:splitBy("'dt.entity.process_group'"))` instead., The dimension key&amp;nbsp;'dt.entity.process_group' has been referenced, but the&amp;nbsp;metric has no such key.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 11:41:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238266#M31287</guid>
      <dc:creator>Naveen</dc:creator>
      <dc:date>2024-02-27T11:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238268#M31289</link>
      <description>&lt;P&gt;You can also use DQL:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.process_group&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You even get yourself a little crazier and go with something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.process_group
| fields entity.name, id, lifetime, managementZones, softwareTechnologies, runs[dt.entity.service] &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and get additional info for each process:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dant3_0-1709035418570.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17904i5355BDE822BA385A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dant3_0-1709035418570.png" alt="Dant3_0-1709035418570.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Query can be executed via the DQL API call also, with the&amp;nbsp;/query: execute , with start/end you can play with the delta and get only the ones that have a delta against now()&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 12:08:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238268#M31289</guid>
      <dc:creator>Dant3</dc:creator>
      <dc:date>2024-02-27T12:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238270#M31290</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/21769"&gt;@Dant3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I am automating something so need it for my script to get it via API.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 12:15:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238270#M31290</guid>
      <dc:creator>Naveen</dc:creator>
      <dc:date>2024-02-27T12:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238276#M31291</link>
      <description>&lt;P&gt;You can execute DQL via API call, swagger to check the schema:&lt;/P&gt;&lt;P&gt;&lt;A href="https://{environmentid}.apps.dynatrace.com/platform/swagger-ui/index.html?urls.primaryName=Grail%20-%20DQL%20Query#/Query%20Execution/query%3Aexecute" target="_blank"&gt;https://{environmentid}.apps.dynatrace.com/platform/swagger-ui/index.html?urls.primaryName=Grail%20-%20DQL%20Query#/Query%20Execution/query%3Aexecute&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 12:32:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238276#M31291</guid>
      <dc:creator>Dant3</dc:creator>
      <dc:date>2024-02-27T12:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238300#M31295</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I do not use powershell but I guess you should adapt ' and " and ` correct expression in Powershell. This is an example about bash vs powershell differences:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -X "GET" ^
  "https://XXXXX.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22HOSTS%22%29&amp;amp;from=now-30m" ^
  -H "accept: application/json; charset=utf-8" ^
  -H "Authorization: Api-Token XXXXX"
  
curl.exe -X 'GET' `
  'https://XXXXX.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22HOSTS%22%29&amp;amp;from=now-30m' `
  -H 'accept: application/json; charset=utf-8' `
  -H 'Authorization: Api-Token XXXXX'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 17:05:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238300#M31295</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2024-02-27T17:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238351#M31303</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/51963"&gt;@Naveen&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Dynatrace API uses pagination concept. So, you have to adopt it in your script (you get next page key in the answer JSON). Theoretically you could define page size with pageSize=xxx, but you will need to know in advance how much PG's you have (or pick it up from the API call as it is there in JSON too).&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Ingrida&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 09:34:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238351#M31303</guid>
      <dc:creator>Ingrida</dc:creator>
      <dc:date>2024-02-28T09:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all process groups in environment?</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238358#M31307</link>
      <description>&lt;P&gt;you can add something similar to this in a python code to extract the information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def send_request(tenant, token, nextPageKey=None):
    base_url = f"{tenant}/api/v2/entities?entitySelector=type(\"PROCESS_GROUP_INSTANCE\")"
    url = get_entity_url(base_url, nextPageKey)
    headers = {'Authorization': f'Api-Token {token}'}

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"Error: {e}")
        return None 


..................................




       nextPageKey = None
        result = []

        while True:
            response = send_request(tenant, token, nextPageKey)
            if not response:
                break

            result += process_response(response)
            nextPageKey = response.get('nextPageKey')

            if not nextPageKey:
                break&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 10:18:45 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-get-all-process-groups-in-environment/m-p/238358#M31307</guid>
      <dc:creator>PacoPorro</dc:creator>
      <dc:date>2024-02-28T10:18:45Z</dc:date>
    </item>
  </channel>
</rss>

