<?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: EntityType and HostSelector in OneAgent Extension migration in Extensions</title>
    <link>https://community.dynatrace.com/t5/Extensions/EntityType-and-HostSelector-in-OneAgent-Extension-migration/m-p/257957#M5259</link>
    <description>&lt;P&gt;HostSelector and EntitySelector objects along with ResultsBuilder and TopologyBuilder no longer exist in the new framework. For OneAgent extensions, the data ingested is automatically linked to the OneAgent host.&lt;/P&gt;&lt;P&gt;For reporting an info event (based on the API documented &lt;A href="https://docs.dynatrace.com/docs/dynatrace-api/environment-api/events-v2/post-event" target="_self"&gt;here&lt;/A&gt;) you can use the `self.report_dt_event` function.&lt;/P&gt;&lt;P&gt;To find out the entity ID of the host running the extension you can use the OneAgent virtual file as documented &lt;A href="https://docs.dynatrace.com/docs/extend-dynatrace/extend-data#oneagent-virtual-files" target="_self"&gt;here&lt;/A&gt;. When the OneAgent detects this file being read it will populate it with entity IDs for the host and monitored processes.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Oct 2024 10:07:10 GMT</pubDate>
    <dc:creator>Radu</dc:creator>
    <dc:date>2024-10-03T10:07:10Z</dc:date>
    <item>
      <title>EntityType and HostSelector in OneAgent Extension migration</title>
      <link>https://community.dynatrace.com/t5/Extensions/EntityType-and-HostSelector-in-OneAgent-Extension-migration/m-p/257945#M5255</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;I need to migrate OneAgent Extension using&amp;nbsp;&lt;SPAN&gt;EntityType and&amp;nbsp;HostSelector. Can you please help answer the queries mentioned in table below:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; ruxit.api.base_plugin &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; BasePlugin&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; ruxit.api.selectors &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; EntityType&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; ruxit.api.selectors &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; HostSelector&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;entities &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;self&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;STRONG&gt;get_monitored_entities()&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;host_entity &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;None&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; entity &lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt; entities:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;&lt;SPAN&gt;.logger.info(&lt;/SPAN&gt;&lt;SPAN&gt;"Monitored entity: id=&lt;/SPAN&gt;&lt;SPAN&gt;%s&lt;/SPAN&gt;&lt;SPAN&gt;, type=&lt;/SPAN&gt;&lt;SPAN&gt;%s&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, entity.id, entity.type)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; entity.type &lt;/SPAN&gt;&lt;SPAN&gt;==&lt;/SPAN&gt;&lt;SPAN&gt; EntityType.&lt;/SPAN&gt;&lt;SPAN&gt;HOST&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host_entity &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; entity&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;&lt;SPAN&gt;.results_builder.report_custom_info_event(&lt;/SPAN&gt;&lt;SPAN&gt;description=&lt;/SPAN&gt;&lt;SPAN&gt;"One or more processes are unavailable"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;title=&lt;/SPAN&gt;&lt;SPAN&gt;"Host Unhealthy"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;entity_selector=&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;HostSelector()&lt;/STRONG&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;STRONG&gt;Question/Comments&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;entities = self.get_monitored_entities()&lt;/TD&gt;&lt;TD width="50%"&gt;Is this function usable in new Extension framework ?&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;P&gt;from ruxit.api.selectors import EntityType&lt;/P&gt;&lt;P&gt;entity.type == EntityType.HOST:&lt;/P&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;We have this code in Extension.&lt;/P&gt;&lt;P&gt;Is EntityType valid in new Framework ?&lt;/P&gt;&lt;P&gt;If no, how to import&amp;nbsp;EntityType in new framework&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;P&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; ruxit.api.selectors &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; HostSelector&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;self.results_builder.report_custom_info_event(description="One or more processes are unavailable", title="Host Unhealthy", entity_selector=&lt;STRONG&gt;HostSelector()&lt;/STRONG&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;P&gt;We have this code in Extension.&lt;/P&gt;&lt;P&gt;Is &lt;SPAN&gt;HostSelector&lt;/SPAN&gt; valid in new Framework ?&lt;/P&gt;&lt;P&gt;If no, how to import &lt;SPAN&gt;HostSelector&lt;/SPAN&gt; in new framework&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Oct 2024 08:24:14 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/EntityType-and-HostSelector-in-OneAgent-Extension-migration/m-p/257945#M5255</guid>
      <dc:creator>guptasahil942</dc:creator>
      <dc:date>2024-10-03T08:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: EntityType and HostSelector in OneAgent Extension migration</title>
      <link>https://community.dynatrace.com/t5/Extensions/EntityType-and-HostSelector-in-OneAgent-Extension-migration/m-p/257957#M5259</link>
      <description>&lt;P&gt;HostSelector and EntitySelector objects along with ResultsBuilder and TopologyBuilder no longer exist in the new framework. For OneAgent extensions, the data ingested is automatically linked to the OneAgent host.&lt;/P&gt;&lt;P&gt;For reporting an info event (based on the API documented &lt;A href="https://docs.dynatrace.com/docs/dynatrace-api/environment-api/events-v2/post-event" target="_self"&gt;here&lt;/A&gt;) you can use the `self.report_dt_event` function.&lt;/P&gt;&lt;P&gt;To find out the entity ID of the host running the extension you can use the OneAgent virtual file as documented &lt;A href="https://docs.dynatrace.com/docs/extend-dynatrace/extend-data#oneagent-virtual-files" target="_self"&gt;here&lt;/A&gt;. When the OneAgent detects this file being read it will populate it with entity IDs for the host and monitored processes.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2024 10:07:10 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/EntityType-and-HostSelector-in-OneAgent-Extension-migration/m-p/257957#M5259</guid>
      <dc:creator>Radu</dc:creator>
      <dc:date>2024-10-03T10:07:10Z</dc:date>
    </item>
  </channel>
</rss>

