# EntityType and HostSelector in OneAgent Extension migration

**URL:** <https://community.dynatrace.com/t/entitytype-and-hostselector-in-oneagent-extension-migration/48114>\
**Category:** Extensions\
**Tags:** extensions\
**Created:** [October 3, 2024, 8:24am UTC](https://community.dynatrace.com/t/entitytype-and-hostselector-in-oneagent-extension-migration/48114 "2024-10-03T08:24:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guptasahil942](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@guptasahil942](https://community.dynatrace.com/u/guptasahil942)\
**Post date:** [October 3, 2024, 8:24am UTC](https://community.dynatrace.com/t/entitytype-and-hostselector-in-oneagent-extension-migration/48114/1 "2024-10-03T08:24:14Z")

</div>

I need to migrate OneAgent Extension using&nbsp;EntityType and&nbsp;HostSelector. Can you please help answer the queries mentioned in table below:from ruxit.api.base\_plugin import BasePluginfrom ruxit.api.selectors import EntityTypefrom ruxit.api.selectors import HostSelectorentities = self.**get\_monitored\_entities()**  
host\_entity = Nonefor entity in entities:&nbsp; &nbsp; &nbsp;self.logger.info(“Monitored entity: id=%s, type=%s”, entity.id, entity.type)&nbsp; &nbsp; &nbsp;if entity.type == EntityType.HOST:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; host\_entity = entityself.results\_builder.report\_custom\_info\_event(description=“One or more processes are unavailable”, title=“Host Unhealthy”, entity\_selector=**HostSelector()**)

| **Issue** | **Question/Comments** |
| &nbsp; | &nbsp; |
| entities = self.get\_monitored\_entities() | Is this function usable in new Extension framework ? |
| from ruxit.api.selectors import EntityTypeentity.type == EntityType.HOST: | We have this code in Extension.Is EntityType valid in new Framework ?If no, how to import&nbsp;EntityType in new framework |
| from ruxit.api.selectors import HostSelectorself.results\_builder.report\_custom\_info\_event(description="One or more processes are unavailable", title="Host Unhealthy", entity\_selector=**HostSelector()**) | We have this code in Extension.Is HostSelector valid in new Framework ?If no, how to import HostSelector in new framework |

---

<div class="post-metadata">

**Author:** ![Radu](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radu/32/23351_2.png) [@Radu](https://community.dynatrace.com/u/Radu)\
**Post date:** [October 3, 2024, 10:07am UTC](https://community.dynatrace.com/t/entitytype-and-hostselector-in-oneagent-extension-migration/48114/2 "2024-10-03T10:07:10Z")

</div>

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.

For reporting an info event (based on the API documented [here](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/events-v2/post-event)) you can use the `self.report_dt_event` function.

To find out the entity ID of the host running the extension you can use the OneAgent virtual file as documented [here](https://docs.dynatrace.com/docs/extend-dynatrace/extend-data#oneagent-virtual-files). When the OneAgent detects this file being read it will populate it with entity IDs for the host and monitored processes.
