<?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: Host List without Management Zone in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235750#M30816</link>
    <description>&lt;P&gt;This looks interesting,&lt;/P&gt;&lt;PRE&gt;fetch dt.entity.host
| fieldsAdd managementZones
| filter isNull(managementZones)&lt;/PRE&gt;&lt;P&gt;What do I need to add to search by a particular management zone?&amp;nbsp; contains or equal? need the DQL.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jan 2024 12:11:35 GMT</pubDate>
    <dc:creator>MarwanC</dc:creator>
    <dc:date>2024-01-29T12:11:35Z</dc:date>
    <item>
      <title>Host List without Management Zone</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235199#M30664</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I'd like to output a list of Hosts that are not in a ManagementZone.&lt;BR /&gt;The EntitySelector does not allow us to do this.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Do you have an idea?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 14:50:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235199#M30664</guid>
      <dc:creator>gbaudart</dc:creator>
      <dc:date>2024-01-23T14:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235203#M30665</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would say using entities API:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Call &lt;A title="entities API" href="https://docs.dynatrace.com/docs/shortlink/api-entities-v2-get-all-entities-list" target="_blank" rel="noopener"&gt;entities API&lt;/A&gt; to get a full host list.&lt;/LI&gt;&lt;LI&gt;Call &lt;A title="entity API" href="https://docs.dynatrace.com/docs/shortlink/api-entities-v2-get-entity" target="_blank" rel="noopener"&gt;entity API&lt;/A&gt; per host ID in before query.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Second one is providing much more information than mz, but you can see if that host has a MZ or not:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AntonPineiro_0-1706003113199.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17117i518DFC9BDB5BE53A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AntonPineiro_0-1706003113199.png" alt="AntonPineiro_0-1706003113199.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 09:45:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235203#M30665</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2024-01-23T09:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235395#M30736</link>
      <description>&lt;P&gt;Isn't there an easier way to get the information?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 15:54:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235395#M30736</guid>
      <dc:creator>gbaudart</dc:creator>
      <dc:date>2024-01-24T15:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235403#M30738</link>
      <description>&lt;P&gt;This may help, part of a dashboard - not my code, from a DT SME.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import { monitoredEntitiesClient } from '@dynatrace-sdk/client-classic-environment-v2';

export default async function() {
  // Check if that tile should be activated based on selected indicators and scope
  if($Indicators[0] === "All" || $Indicators.includes("hostGroupCoverage")) {
    let scope;
    if($Scope[0] === "Tenant") {
      scope = 'Tenant';
    } else {
      let mzList = "";
      for(let i=0; i&amp;lt;$Scope.length; i++) {
        mzList += i === 0 ? `"${$Scope[i]}"` : `,"${$Scope[i]}"`;
      }
      scope = mzList;
    }
    // Define entity selector based on the selected scope
    let entitySelector;
    if(scope === "Tenant") {
      entitySelector = 'type("HOST"),isMonitoringCandidate(false)';
    } else {
      entitySelector = `type("HOST"),isMonitoringCandidate(false),mzName(${scope})`;
    }
    let config = { from: `now-1d`, entitySelector: entitySelector};
    // Get all monitored hosts
    const monitoredHosts = await monitoredEntitiesClient.getEntities(config);
    // Define entity selector based on the selected scope
    if(scope === "Tenant") {
      entitySelector = 'type("HOST"),isMonitoringCandidate(false),fromRelationships.isInstanceOf(type("HOST_GROUP"))';
    } else {
      entitySelector = `type("HOST"),isMonitoringCandidate(false),fromRelationships.isInstanceOf(type("HOST_GROUP")),mzName(${scope})`;
    }
    config = { from: `now-1d`, entitySelector: entitySelector};
    // Get all monitored hosts that are assigned with a host group
    const hostsWithHostGroup = await monitoredEntitiesClient.getEntities(config);
    // Compute host group coverage
    const hostGroupCoverage = parseInt(hostsWithHostGroup.totalCount/monitoredHosts.totalCount*100);
    // Compute local score based on the host group coverage
    const score = hostGroupCoverage === 100 ? 1 : (hostGroupCoverage &amp;gt;= 80 ? 0.5 : 0);
    let result;
    switch(true) {
      case score === 1:
        result = `&lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; ${hostGroupCoverage}%`;
        break;
      case score === 0.5:
        result = `&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; ${hostGroupCoverage}%`;
        break;
      case score === 0:
        result = `&lt;span class="lia-unicode-emoji" title=":warning:"&gt;⚠️&lt;/span&gt; ${hostGroupCoverage}%`;
        break;
    }
    // Return the emojied result
    return result;
  } else {
    return "N/A";
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 16:29:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235403#M30738</guid>
      <dc:creator>PraWij</dc:creator>
      <dc:date>2024-01-24T16:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235406#M30739</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Maybe easier can be using Grail, if it is enabled in your tenant. I think you know more Grail than mine but something as that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host 
|  expand managementZones
|  filter managementZones == ""&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 17:14:08 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235406#M30739</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2024-01-24T17:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235414#M30744</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/64361"&gt;@PraWij&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this code.&lt;/P&gt;&lt;P&gt;OK, but what are the $Indicators and $Scope variables?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 19:51:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235414#M30744</guid>
      <dc:creator>gbaudart</dc:creator>
      <dc:date>2024-01-24T19:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235415#M30745</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/58682"&gt;@AntonPineiro&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This doesn't work. I'll try with the sdk&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 19:52:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235415#M30745</guid>
      <dc:creator>gbaudart</dc:creator>
      <dc:date>2024-01-24T19:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235556#M30772</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PraWij_0-1706203177210.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17219i15937A16B96FB3F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PraWij_0-1706203177210.png" alt="PraWij_0-1706203177210.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the full dashboard, scope also includes the mgmt zones.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indicators example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PraWij_1-1706203301677.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17221iEF7770A2607E9DFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PraWij_1-1706203301677.png" alt="PraWij_1-1706203301677.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 17:22:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235556#M30772</guid>
      <dc:creator>PraWij</dc:creator>
      <dc:date>2024-01-25T17:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235702#M30796</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can try this one, looks like is working:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host
| fieldsAdd managementZones
| filter isNull(managementZones)&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AntonPineiro_0-1706377351198.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/17264i130606CDEECE45A9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AntonPineiro_0-1706377351198.png" alt="AntonPineiro_0-1706377351198.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 17:42:40 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235702#M30796</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2024-01-27T17:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Host List without Management Zone</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235750#M30816</link>
      <description>&lt;P&gt;This looks interesting,&lt;/P&gt;&lt;PRE&gt;fetch dt.entity.host
| fieldsAdd managementZones
| filter isNull(managementZones)&lt;/PRE&gt;&lt;P&gt;What do I need to add to search by a particular management zone?&amp;nbsp; contains or equal? need the DQL.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 12:11:35 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235750#M30816</guid>
      <dc:creator>MarwanC</dc:creator>
      <dc:date>2024-01-29T12:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Host List without Management Zone</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235771#M30817</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Maybe more than one option but looks like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host
| fieldsAdd managementZones
| filter matchesValue(managementZones, "XXXXXX")&lt;/LI-CODE&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 13:23:20 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235771#M30817</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2024-01-29T13:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235813#M30822</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/58682"&gt;@AntonPineiro&lt;/a&gt;&amp;nbsp;This works for me. Thanks a lot.&lt;/P&gt;&lt;P&gt;Tijust&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 06:05:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235813#M30822</guid>
      <dc:creator>sujit_k_singh</dc:creator>
      <dc:date>2024-01-30T06:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Host List with no Mz</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235843#M30825</link>
      <description>&lt;P&gt;You are welcome!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 11:01:39 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Host-List-without-Management-Zone/m-p/235843#M30825</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2024-01-30T11:01:39Z</dc:date>
    </item>
  </channel>
</rss>

