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

List all incoming process connections using API

holst
Guide

We have hundreds of Hosts, and among them like 50 running MS SQL database. Now we want to list all hosts/processes calling these MS SQL databases.  

For a single host I can select the MS SQL process and use UI to see incoming processes.  Now I want to do that for all servers, using API.  I cant find anything how to do this in scale.  We dont want to do it manually, becuase even if we spend a couple of hours doing it manually, we need an updated report next month.

Any ideas or suggestions?

NOTE, majority of Hosts only have Infrastructure mode agent.

2 REPLIES 2

axel_tapia
Observer

Not sure if this is what you are look for, I think you can get that by using entities API.

entitySelector  query:

type(HOST),toRelationships.isProcessOf(type(PROCESS_GROUP_INSTANCE),toRelationships.isNetworkClientOf(type(PROCESS_GROUP_INSTANCE),softwareTechnologies(MICROSOFT_SQL_SERVER))

This will bring all host that have any PROCESS_GROUP_INSTANCE talking to any SQL Server PROCESS_GROUP_INSTANCES.

Curl example:

curl -X 'GET' \
'[dynatrace_url]/api/v2/entities?entitySelector=type(HOST),toRelationships.isProcessOf(type(PROCESS_GROUP_INSTANCE),toRelationships.isNetworkClientOf(type(PROCESS_GROUP_INSTANCE),softwareTechnologies(MICROSOFT_SQL_SERVER)))' \
-H 'accept: application/json; charset=utf-8' \
-H 'Authorization: Api-Token dt0c01.XXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

 

Same query can be used in auto-tagging rule or management zone.

Hi @holst 

Thanks for raising such concern.

  • please note, that Topology & Smartscape - Process group is no longer available under environment Api v1 and it's accessible through environment Api v2.
  • for which it will require creating an access token with "entities.read" scope.

Peter_Youssef_0-1727293429651.png

  • Having admin privileges> go to environment Api v2 > monitored entities > unlock using the created token, otherwise you should have at least the right to create personal access token with "environment:roles:viewer" otherwise the Dynatrace admin will create the token and provide you with the target API to utilize constantly as long as the token will never expire.
  • start specifying the below parameters to get the intended result.

Peter_Youssef_1-1727294304180.png

Peter_Youssef_2-1727294505202.png

for monthly result

Peter_Youssef_3-1727294576353.png

for sorting 

Peter_Youssef_4-1727294678644.png

Execute and the below result message "200" should appear and you will be able to download the Json file.

Peter_Youssef_5-1727294745636.png

for the curl bash you should receive the curl command to call the api externally

curl -X 'GET' \
'https://abcdef/e/env_id/api/v2/entities?pageSize=500&entitySelector=type%28HOST%29%2CtoRelationships...' \
-H 'accept: application/json; charset=utf-8'

You can customize the entity selector as per actual requirements as described by @axel_tapia .

Regards,

Peter.

Featured Posts