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

Dynatrace api v2, how to access host's schemaId (builtin:anomaly-detection.infrastructure-disk) using setting/object REST API

hyperdev
Visitor

The information is accessible thru the UI and not thru the API

https://<tenant>/.../ui/settings/HOST-xxxxxxxxxxxxxxxx/builtin:anomaly-detection.infrastructure-disks?gtf=-2h&gf=all

2 REPLIES 2

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

Easier way would be, going to schema in the UI:

AntonPineiro_0-1739471292296.png

Select "..." -> API:

AntonPineiro_1-1739471368253.png

As you can see there, it is not HOST-id, you need object ID. If you go to full API specification:

AntonPineiro_2-1739471459409.png

I would call all objects you are interested using filters (filtering by schema for example), get objects IDs, and make a second call to get details of ID (disk).

Best regards

 

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Hello,

Here are the results of my REST explorations

Evironment:

  • tenants:
    • 18
  • total Hosts:
    • 45k
  • SchemaId to check:
    • builtin:anomaly-detection.infrastructure-disks.per-disk-override
      • required to check that it's not been disabled accidentally

 

Cynematics:

  • get hosts (18 multipage request)
  • for each host:
    • get /api/v2/entities/HOST-XXXXXXXXXXXXXXXX
    • from each host get: (tens of disks per hosts)
      • "toRelationships": {
        "isDiskOf": [
        {
        "id": "DISK-XXXXXXXXXXXXXXXX",
        "type": "DISK"
        }, 
        ...
        ]
        }
      • for each disk:
        • get /api/v2/settings/objects?schemaIds=builtin%3Aanomaly-detection.infrastructure-disks.per-disk-override&scopes=DISK-XXXXXXXXXXXXXXXX&fields=objectId%2Cvalue

Conclusion:

  • Estimated number of REST request on the schemaId: 45000 times ( average of 10 disks per hosts configured) is 450k
  • About 20 hours to get the informations at 10 millisec per request.
    • Tools used:
      • python 3.11
      • asyncio

This should be available at the HOST level just like the UI is offering, as it's not practical to use the UI to check 45k hosts

 

 

Featured Posts