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

pgi_name in Extensions 2.0

guptasahil942
Participant

Hello Team,

I am migrating extensions to framework 2.0. It seems that pgi_name is deprecated in new framework.
 
How can I find the group_instance_id in new framework ?
 
from ruxit.api.snapshot import pgi_name
pgi = self.find_single_process_group(pgi_name('sftpserver'))
pgi_id = pgi.group_instance_id
2 REPLIES 2

TomásSeroteRoos
Dynatrace Advisor
Dynatrace Advisor

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

The above solution did not work. So , used Read entity API token in Extension to fetch and filter pgi id . 

Featured Posts