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

How to filter a one disk from builtin:host.disk.usedPct with /metrics/query

Yosi_Neuman
DynaMight Leader
DynaMight Leader

Hi guys,

Is there a way to set entitySelector to get information for specific disk from builtin:host.disk.usedPct metric with /metrics/query rest call?

When filtering by host

Yosi_Neuman_0-1652775459477.png

We get answer with value

Yosi_Neuman_1-1652775518523.png

When trying to filter by disk 

Yosi_Neuman_2-1652775663336.png

We get empty answer

Yosi_Neuman_3-1652775690532.png

Is that a bug or a feature or something that I have done wrong ?

Thanks in advance for your input on this question 

Yos 

 

dynatrace certificated professional - dynatrace primer partner - Matrix Soft Ware Division - Israel
4 REPLIES 4

JamesKitson
Dynatrace Guru
Dynatrace Guru

It seems like the issue may be that for some of the older metrics the primary entity must be included in the selector which for this metric is the host and that approach doesn't include that when filtering to the disk in the entity selector.


I did try a few alternatives though where you can include the disk id filter in the query itself to get the same desired result.

 

Using entity selector still, just in the metric selector as a filter:
builtin:host.disk.usedPct:filter(in("dt.entity.disk",entitySelector("entityId("DISK-XXXXXXXX")"))):splitBy("dt.entity.disk")

Just filtering on the disk id itself without a selector:
builtin:host.disk.usedPct:filter(eq("dt.entity.disk", "DISK-XXXXXXXX")):splitBy("dt.entity.disk")

 

Hi @JamesKitson 

Thanks for your reply.

This filter works perfectly when using it within Data explorer code.

Yosi_Neuman_0-1652814177543.png

Our issue is when trying to convert this filter to rest api entitySelector 

Yosi_Neuman_1-1652814237034.png

Any suggestion how to convent this filter to entitySelector?

Yos 

dynatrace certificated professional - dynatrace primer partner - Matrix Soft Ware Division - Israel

You can add the filters (either the entity selector approach or the somewhat simpler disk dimension filter) in the metricSelector field of the API call. When you add the disk entity selector in that entitySelector field it filters out the host which needs to be present for this metric as that is it's 'primary' dimenions.

 

So don't use the entitySelector field and just put the whole thing (including the filter) in the metricSelector field:

JamesKitson_1-1652814906169.png

 

JamesKitson_2-1652814977529.png

 

Thanks again @JamesKitson 

Will use this 

All the best 

Yos 

 

 

dynatrace certificated professional - dynatrace primer partner - Matrix Soft Ware Division - Israel