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

V2 Query API - Can I filter by column in a custom metric?

louis_gallo
Helper

I have a multi-dimension custom metric that returns three dimensions. I would like to just filter and get one particular dimension:

 

metricId,name,column,host.name,dt.host_group.id,dt.entity.host,time,value
custom.mymetric,Foobar,cpulmt,myserver.example.com,Linux,HOST-A1FE2C339700D559,2022-08-30 19:47:00,18.200000762939453
custom.mymetricFoobar,cpupct,myserver.example.com,Linux,HOST-A1FE2C339700D559,2022-08-30 19:48:00,81.7
custom.mymetrixFoobar,iops,myserver.example.com,Linux,HOST-A1FE2C339700D559,2022-08-30 19:49:00,2023

 

What would I add to my V2 API query to just get "cpulmt" column records?

 

Any help appreciated.

 

Lou

2 REPLIES 2

adam_gardner
Dynatrace Champion
Dynatrace Champion

A few pointers:
1) Please read this page to understand the syntax and options.
2) Why are you pushing infra metrics on something with a host ID? You get that already with the OneAgent?
2) The time field won't work as you expect. As per above page it should be timestamp in UTC millis.
3) Those lines don't work as they are listed above.

Finally, it looks like you're trying to add metrics where a OneAgent is already available on that host? If so, why not use dynatrace_ingest utility instead. Topology relationships happen "automatically".

If you do actually want to push metrics from outside (via the API) then I'd either suggest 3 separate metrics:

 

custom.mymetric.cpulmt,hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 18.200000762939453
custom.mymetric.cpupct,hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 81.7
custom.mymetric.iops,hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 2023

 

adam_gardner_0-1661990003587.png


OR push a single metric with a new dimension (split & filter):

 

custom.mymetric,type="cpulmt",hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 18.200000762939453
custom.mymetric,type="cpupct",hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 81.7
custom.mymetric,type="iops",hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 2023

 

adam_gardner_1-1661990198220.png


Perhaps you could elaborate on the actual usecase and I can advise the "correct" solution?

Ana_Kuzmenchuk
Community Team
Community Team

Hi @louis_gallo., was the below reply helpful? If not, please share more details so the Community members could help you fully 😉

The only constant is change. Finding ways for great things to happen!

Featured Posts