27 Apr 2023 12:42 PM - last edited on 28 Apr 2023 08:08 AM by MaciejNeumann
Goal: Find out the API way to get host-name, host-id, disk-name, disk-id.
Use case sample:
Question: which API or multi-APIs can help to get above 4 infos (host-name, host-id, disk-name, disk-id)?
FYI Reference: https://community.dynatrace.com/t5/Dynatrace-API/Correlating-multiple-disk-entities-within-host-enti... ( but 1) we do not think that API is correct one, plus 2) that URL also has similar concern of how to find DISK-name and associate host via disk-id)
Solved! Go to Solution.
27 Apr 2023 11:49 PM
Hi,
I would use Monitored entities API - GET an entity . It return host id, host display name and disks ids.
"entityId": "HOST-06F288EE2A930951",
"displayName": "my host",
"toRelationships": {
"isDiskOf": [
{
"id": "DISK-0393340DCA3853B0",
"type": "DISK"
}
]
}
You can use same API to get disk display name.
Best regards
08 May 2023 07:00 PM
Thanks!
So in total - 2 run of same API but with diff entities -
09 May 2023 08:04 AM
Hi,
Yes.
Best regards
07 Feb 2024 05:15 PM
Here is the Curl Commands for each layer:
To get the Disks on a host:
curl -X 'GET' \ 'https://<YOUR ID>.live.dynatrace.com/api/v2/entities/HOST-<ID>?fields=properties%2Ctags%2Cmanagement... \ -H 'accept: application/json; charset=utf-8' \ -H 'Authorization: Api-Token <YOUR TOKEN>'
To Get the True Disk name from the Disk IDs:
curl -X 'GET' \ 'https://<YOUR ID>.live.dynatrace.com/api/v2/entities/DISK-<ID>?fields=properties%2Ctags%2Cmanagement... \ -H 'accept: application/json; charset=utf-8' \ -H 'Authorization: Api-Token <YOUR TOKEN>'