04 Sep 2024 10:11 AM
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.
10 Sep 2024 05:39 PM
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.
25 Sep 2024 09:19 PM
Hi @holst
Thanks for raising such concern.
for monthly result
for sorting
Execute and the below result message "200" should appear and you will be able to download the Json file.
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.