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

Get builtin:osservice.availability metrics filtered by os:service tags

olegus
Helper

I have os:service entities tagged with an Uptime tag - I want to get availability metrics only for those services via API.

Here is my current metric selector that does not consider tags. It works in API v2:
(builtin:osservice.availability:filter(prefix("dt.entity.os:service",CUSTOM_DEVICE-)):filter(or(eq("dt.osservice.status",running),eq("dt.osservice.status",active))):sum:auto:sort(value(sum,descending)):splitBy("dt.entity.host","dt.entity.os:service")/builtin:osservice.availability:filter(prefix("dt.entity.os:service",CUSTOM_DEVICE-)):sum:auto:sort(value(sum, descending)):splitBy("dt.entity.host","dt.entity.os:service")*100):setUnit(Percent):sort(dimension("dt.entity.host",ascending),dimension("dt.entity.os:service",ascending))

How can I edit it to filter by specific tags?

That's what I have tried so far:

In DT API Swagger page I can specify EntitySelector:

type(os:service),tag(Uptime)

, which suppose to do it, but I'm getting this error:
"Entity type mismatch: the entity selector matches type `os:service`, but no primary entity dimension in the given metric selector has such type. Possible primary entity types: [`HOST`]. Alternatively, use an embedded entity selector. For example, `yourMetricKey:filter(in(dt.entity.disk, entitySelector(\"...\"))`."

I followed the advice and tried to use embedded entitySelector :
filter(in("dt.entity.os:service",entitySelector(type("os:service"),tag(Uptime)))

And now here is the result:

"Metric selector parse error: expected one argument for `entitySelector`"

 

Any idea how can I grab this metric only for tagged os:service entities?

 

Thanks,

Oleg

 

1 REPLY 1

erh_inetum
Champion

Hi Oleg,

Have you tried to filter by OS Service - Tag?

 

erh_inetum_1-1740548215831.png

Or you've tried but you receive any error to add this filter to the rest of filters you need to your metric?

 

Regards,

Elena.

Featured Posts