11 Dec 2024 07:05 AM
Hello Team,
10 Jan 2025 10:34 AM - edited 10 Jan 2025 10:35 AM
In EF2 you will need to use the get_snapshot() method to access the OneAgent snapshot file with PG and PGI information.
The Snapshot object then has a get_process_groups_by_technology method that you could use.
Try something like this (untested code):
from dynatrace_extension import Extension
class ExtensionImpl(Extension):
def query(self):
snapshot = self.get_snapshot() # returns a Snapshot object
pg_list = snapshot.get_process_groups_by_technology("sftpserver") # returns list[Entry]
for pg in pg_list:
pgi_id = pg.group_instance_id
10 Jan 2025 11:16 AM
The above solution did not work. So , used Read entity API token in Extension to fetch and filter pgi id .
03 Feb 2025 06:38 PM
could you please share the stapes and the code to read
04 Feb 2025 07:30 AM
You should be able to simply call self.get_snapshot like I exemplified above to get the OneAgent snapshot file (which by default /var/log/dynatrace/oneagent/plugin/oneagent_latest_snapshot.log on Linux and %PROGRAMDATA%\dynatrace\oneagent\log\plugin\oneagent_latest_snapshot.log).
If you are running the extension locally in development mode (with dt-sdk run) you will need to specify the path yourself. The recommended approach is you copy an example snapshot file into your development directory and use that.