<?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 Get builtin:osservice.availability metrics filtered by os:service tags in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/270986#M3624</link>
    <description>&lt;P&gt;I have os:service entities tagged with an Uptime tag - I want to get availability metrics only for those services via API.&lt;/P&gt;
&lt;P&gt;Here is my current metric selector that does not consider tags. It works in API v2:&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;(builtin:osservice.availability:filter(prefix("dt.entity.os:service",CUSTOM_DEVICE-)):filter(or(eq("dt.osservice.status",running),eq("dt.osservice.status",active))):sum:auto:sort(value(sum,descending)):splitBy("dt.entity.host","dt.entity.os:service")/builtin:osservice.availability:filter(prefix("dt.entity.os:service",CUSTOM_DEVICE-)):sum:auto:sort(value(sum, descending)):splitBy("dt.entity.host","dt.entity.os:service")*100):setUnit(Percent):sort(dimension("dt.entity.host",ascending),dimension("dt.entity.os:service",ascending))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;How can I edit it to filter by specific tags?&lt;/P&gt;
&lt;P&gt;That's what I have tried so far:&lt;/P&gt;
&lt;P&gt;In DT API Swagger page I can specify EntitySelector:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;type(os:service),tag(Uptime)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;, which suppose to do it, but I'm getting this error:&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;"Entity type mismatch: the entity selector matches type `os:service`, but no primary entity dimension in the given metric selector has such type. Possible primary entity types: [`HOST`]. Alternatively, use an embedded entity selector. For example, `yourMetricKey:filter(in(dt.entity.disk, entitySelector(\"...\"))`."&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;I followed the advice and tried to use embedded entitySelector :&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;filter(in("dt.entity.os:service",entitySelector(type("os:service"),tag(Uptime)))&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;And now here is the result:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;"Metric selector parse error: expected one argument for `entitySelector`"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Any idea how can I grab this metric only for tagged os:service entities?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Oleg&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Feb 2025 11:37:46 GMT</pubDate>
    <dc:creator>olegus</dc:creator>
    <dc:date>2025-02-26T11:37:46Z</dc:date>
    <item>
      <title>Get builtin:osservice.availability metrics filtered by os:service tags</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/270986#M3624</link>
      <description>&lt;P&gt;I have os:service entities tagged with an Uptime tag - I want to get availability metrics only for those services via API.&lt;/P&gt;
&lt;P&gt;Here is my current metric selector that does not consider tags. It works in API v2:&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;(builtin:osservice.availability:filter(prefix("dt.entity.os:service",CUSTOM_DEVICE-)):filter(or(eq("dt.osservice.status",running),eq("dt.osservice.status",active))):sum:auto:sort(value(sum,descending)):splitBy("dt.entity.host","dt.entity.os:service")/builtin:osservice.availability:filter(prefix("dt.entity.os:service",CUSTOM_DEVICE-)):sum:auto:sort(value(sum, descending)):splitBy("dt.entity.host","dt.entity.os:service")*100):setUnit(Percent):sort(dimension("dt.entity.host",ascending),dimension("dt.entity.os:service",ascending))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;How can I edit it to filter by specific tags?&lt;/P&gt;
&lt;P&gt;That's what I have tried so far:&lt;/P&gt;
&lt;P&gt;In DT API Swagger page I can specify EntitySelector:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;type(os:service),tag(Uptime)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;, which suppose to do it, but I'm getting this error:&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;"Entity type mismatch: the entity selector matches type `os:service`, but no primary entity dimension in the given metric selector has such type. Possible primary entity types: [`HOST`]. Alternatively, use an embedded entity selector. For example, `yourMetricKey:filter(in(dt.entity.disk, entitySelector(\"...\"))`."&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;I followed the advice and tried to use embedded entitySelector :&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;filter(in("dt.entity.os:service",entitySelector(type("os:service"),tag(Uptime)))&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;And now here is the result:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;"Metric selector parse error: expected one argument for `entitySelector`"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Any idea how can I grab this metric only for tagged os:service entities?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Oleg&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2025 11:37:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/270986#M3624</guid>
      <dc:creator>olegus</dc:creator>
      <dc:date>2025-02-26T11:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get builtin:osservice.availability metrics filtered by os:service tags</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/271009#M3625</link>
      <description>&lt;P&gt;Hi Oleg,&lt;/P&gt;&lt;P&gt;Have you tried to filter by OS Service - Tag?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erh_inetum_1-1740548215831.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26654iF03F0BB8137F2F7E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erh_inetum_1-1740548215831.png" alt="erh_inetum_1-1740548215831.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Or you've tried but you receive any error to add this filter to the rest of filters you need to your metric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Elena.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2025 05:41:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/271009#M3625</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2025-02-26T05:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get builtin:osservice.availability metrics filtered by os:service tags</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/273946#M3683</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/65794"&gt;@olegus&lt;/a&gt;&amp;nbsp;FYI if you've missed answer above:)&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 11:10:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/273946#M3683</guid>
      <dc:creator>Michal_Gebacki</dc:creator>
      <dc:date>2025-03-31T11:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get builtin:osservice.availability metrics filtered by os:service tags</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/274470#M3689</link>
      <description>&lt;P&gt;You need to escape the quotes for the selector to work, try it like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;builtin:osservice.availability
:filter(
    in("dt.entity.os:service",entitySelector("type(os:service),tag(Uptime)"))
    )
:splitBy("dt.entity.os:service"):sort(value(auto,descending))&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 05 Apr 2025 08:55:29 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Get-builtin-osservice-availability-metrics-filtered-by-os/m-p/274470#M3689</guid>
      <dc:creator>mark_bley</dc:creator>
      <dc:date>2025-04-05T08:55:29Z</dc:date>
    </item>
  </channel>
</rss>

