21 May 2025 10:43 PM
What is the best way to create a DQL code that lists the local host disk space used for Windows and Linux servers? I need only the local physical disk, not to show the mapped network drives. I'm using this code, and it shows local and network drives. Not sure how to filter for local drives only. Any recommendations? Thanks:
Solved! Go to Solution.
21 May 2025 11:28 PM
I don't think there is a dedicated entity attribute to distinguish between local and network drives. This means you may have to filter at the end of the query based on some sort of name pattern that would match local drives and not network drives. Is there a specific pattern in how local drives are named when compared to network drives that you could filter on?
22 May 2025 01:03 AM
@mrigau If your network drives have a format something like "\\NAME\SOFTWARE" you can add filter to exclude . Below is an example
timeseries { avg(dt.host.disk.used.percent), value.A = avg(dt.host.disk.used.percent, scalar: true) }, by: { host.name, dt.entity.disk }, filter: { NOT matchesValue(entityAttr(dt.entity.disk, "entity.name"), "\\*") }
| fieldsAdd dt.entity.disk.name = entityName(dt.entity.disk)
22 May 2025 11:42 PM
What about this metric?: storage.disk.fstype
I can probably filter by the type of Linux disk to get this done. How can I incorporate a lookup to read this disk type?
23 May 2025 07:56 AM - edited 23 May 2025 07:58 AM
Hi
You can try adding the 'filesystemType' and then filter on it :
timeseries { avg(dt.host.disk.used.percent), value.A = avg(dt.host.disk.used.percent, scalar: true) }, by: { host.name, dt.entity.disk }, filter: { NOT matchesValue(entityAttr(dt.entity.disk, "entity.name"), "\\*") }
| fieldsAdd dt.entity.disk.name = entityName(dt.entity.disk), fstype = entityAttr(dt.entity.disk, "filesystemType")
I've tried it out on my tenant, it seems to work for some OS and fs type but also got a lot of null values...
23 May 2025 04:21 PM
Gerald, thanks, this will work for my case. I see in my environment that the data is ok for hosts with newer Dynatrace agents, but older agents like 1.297 and below show as null. Thanks for the recommendations.