DQL
Questions about Dynatrace Query Language
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynatrace API v2: Manage monitored entities - Deprecated in SaaS

Carl_Me
Participant

Hello,

It seems that it's no longer possible to view an entity's properties using the v2 API (/entities) -  see image.

Do you have an example of a DQL query that returns all the properties as the API used to?

We have scripts that make API calls. Will this be deprecated in the near future?

Thanks

 

Carl_Me_0-1769461219546.png

 

 

 

6 REPLIES 6

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

Properties field is being returned using Monitored entities API - GET entities list.

Best regards

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

t_pawlak
Leader

Hi,
Yes — in Dynatrace SaaS the direction is to replace the classic “Monitored entities / Manage monitored entities” API usage with DQL + Smartscape on Grail (and OpenPipeline where applicable). That’s why you see it marked as Deprecated

IMO, u can use DQL to discover which fields/properties exist for an entity type.
Look here:

t_pawlak_0-1769508996570.png

This returns the available fields you can later add via fieldsAdd.
Then you can fetch entities of a given type and add the properties you need.

t_pawlak_1-1769509088534.png

Another TRICK and TIPS. If you want “all types” (topology-style):

smartscapeNodes "*"
| limit 100

t_pawlak_2-1769509160123.png

That’s the “show me nodes regardless of type” approach in Smartscape on Grail.

Her u have links, with u can check:
https://docs.dynatrace.com/docs/whats-new/dynatrace-api/deprecated-apis
https://docs.dynatrace.com/docs/discover-dynatrace/platform/grail/querying-monitored-entities
ANd this what @AntonPineiro send
Monitored entities API - GET entities list.

 

 

 

It's not clear to me how one would replace existing API calls to "api/v2/entities?entitySelector=type..." with "DQL and SmartScape"

Me neither. I find it much more complex to retrieve the information we had in the API's JSON.

Especially when we could use the entity ID and get its configuration. It seems more complex to do in DQL.

Is there an existing endpoint where we can send DQL queries already and I just don't know about it? I'm with the other folks here and don't understand how we are supposed to query for monitored entities from outside of Dynatrace with all of our existing automations and external reporting tools that leverage this API endpoint.

On a related note, if you could create a /dql_query="fetch ..." endpoint that would be awesome!

@LordNykkon the Grail Query Platform API is located at https://<environment>.apps.dynatrace.com/platform/swagger-ui/index.html?urls.primaryName=Grail+-+DQL... (swagger).
The API endpoint itself is https://<environment>.apps.dynatrace.com/platform/storage/query/v1/query:execute 

You need either OAuth client or a Platform token to access this platform API. 
Further docs - https://developer.dynatrace.com/develop/access-platform-apis-from-outside/
https://developer.dynatrace.com/develop/sdks/client-query/#executerequest

Actually, it not that difficult, but requires a little bit more work:

curl -X 'POST' \
  'https://<YOUR_ENVIRONMENT>.apps.dynatrace.com/platform/storage/query/v1/query:execute' \
  -H 'accept: application/json' \
  -H 'enforce-query-consumption-limit: true' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <YOUR_TOKEN>' \
  -d '{
  "query": "fetch dt.entity.host | limit 10",
  "requestTimeoutMilliseconds": 1000
}'



For scripting (especially shell scripting), I'd consider using dtctl instead https://github.com/dynatrace-oss/dtctl :

$ dtctl query "fetch dt.entity.host"
ENTITY NAME  ID                    
node2.xxxx   HOST-CCA6561347DAAA74   
app02.yyy    HOST-7EA1B005A5DDECED 

And it allows you to format to yaml/json too, similar to kubectl.

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts