17 May 2022 09:27 AM - last edited on 21 Aug 2024 08:46 AM by Michal_Gebacki
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
We get answer with value
When trying to filter by disk
We get empty answer
Is that a bug or a feature or something that I have done wrong ?
Thanks in advance for your input on this question
Yos
Solved! Go to Solution.
17 May 2022 07:09 PM
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")
17 May 2022 08:06 PM - edited 17 May 2022 08:54 PM
Hi @JamesKitson
Thanks for your reply.
This filter works perfectly when using it within Data explorer code.
Our issue is when trying to convert this filter to rest api entitySelector
Any suggestion how to convent this filter to entitySelector?
Yos
17 May 2022 08:15 PM - edited 17 May 2022 08:17 PM
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:
17 May 2022 09:05 PM
Thanks again @JamesKitson
Will use this
All the best
Yos
11 Apr 2024 03:13 PM
@Yosi_Neuman - Is it possible to negate a single mount point or list of mount points in metric selector?
Thanks in advance!
Srikanth
13 Apr 2024 06:02 PM - edited 13 Apr 2024 06:27 PM
You can use the Negate criterion with in the entity selector
HTH
Yos
05 Aug 2024 05:30 AM
Thanks James
How do add multiple disks or hosts in the above query?
05 Aug 2024 02:13 PM
I've used something like below to exclude multiple disks..
builtin:host.disk.usedPct:filter(and(or(in("dt.entity.host",entitySelector("type(host),tag(~"XXX:XXX~"),tag(~"XXX:XXX~"),tag(~"[Environment]XXX:XXX~"),tag(~"[Environment]XXX:XXX~")"))),not(in("dt.entity.disk",entitySelector("type(disk),entityName.in(~"/~",~"/dev~",~"/boot~",~"/boot/efi~",~"/admin~",~"/audit~",~"/home~",~"/home2~",~"/mksysbfs~",~"/opt~",~"/backup/Config~",~"/opt/core~",~"/opt/DoOnceAIX~",~"/opt/samgr/systemlogs~",~"/proc~",~"/sys~",~"/tmp~",~"/users~",~"/usr~",~"/usr/local/lrs~",~"/var~",~"/var/adm/perfmgr~",~"/var/adm/ras/livedump~",~"/var/cache/yum~",~"/var/crash~",~"/var/log~",~"/var/log/audit~",~"/var/perf~",~"/var/perf/pm~",~"/var/spool/lpd/qdir~",~"/var/spool/qdaemon~",~"/rpool~",~"/var/cache/dnf~")")))))
05 Aug 2024 03:05 PM
Thanks
builtin:host.disk.free:filter(and(or(in("dt.entity.disk",entitySelector("type(disk),entityName.equals(~"/obidata~")"))),
or(in("dt.entity.disk",entitySelector("type(disk),entityName.equals(~"/opt~")")))))
:splitBy("dt.entity.host","dt.entity.disk"):avg:sort(value(avg,descending))
What is the issue with above query. when i execute separately it is working and when i combine it is not giving any result.