cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EntityType and HostSelector in OneAgent Extension migration

guptasahil942
Participant
I need to migrate OneAgent Extension using EntityType and HostSelector. Can you please help answer the queries mentioned in table below:
 
from ruxit.api.base_plugin import BasePlugin
from ruxit.api.selectors import EntityType
from ruxit.api.selectors import HostSelector
 
entities = self.get_monitored_entities()

host_entity = None
for entity in entities:
     self.logger.info("Monitored entity: id=%s, type=%s", entity.id, entity.type)
     if entity.type == EntityType.HOST:
                host_entity = entity
 
self.results_builder.report_custom_info_event(description="One or more processes are unavailable", title="Host Unhealthy", entity_selector=HostSelector())
 
IssueQuestion/Comments
  
entities = self.get_monitored_entities()Is this function usable in new Extension framework ?

from ruxit.api.selectors import EntityType

entity.type == EntityType.HOST:

We have this code in Extension.

Is EntityType valid in new Framework ?

If no, how to import EntityType in new framework

from ruxit.api.selectors import HostSelector

self.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

1 REPLY 1

Radu
Dynatrace Champion
Dynatrace Champion

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) 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. When the OneAgent detects this file being read it will populate it with entity IDs for the host and monitored processes.

Featured Posts