# DQL to Display Local Disk Usage on Dashboards (Windows & Linux)

**URL:** <https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743>\
**Category:** Dashboarding\
**Tags:** dql, dynatrace-managed, latest-dynatrace, dashboards\
**Created:** [May 21, 2025, 9:43pm UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743 "2025-05-21T21:43:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrigau](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mrigau](https://community.dynatrace.com/u/mrigau)\
**Post date:** [May 21, 2025, 9:43pm UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743/1 "2025-05-21T21:43:10Z")

</div>

What is the best way to create a DQL code that lists the local host disk space used for Windows and Linux servers?&nbsp; I need only the local physical disk, not to show the mapped network drives.&nbsp; I’m using this code, and it shows local and network drives. Not sure how to filter for local drives only.&nbsp; Any recommendations?&nbsp; Thanks:

timeseries { Used = avg(dt.host.disk.used.percent), Disk\_Used = avg(dt.host.disk.used.percent, scalar: true) }, by: { dt.entity.host, dt.entity.disk },&nbsp; filter: {&nbsp; &nbsp; matchesValue(entityAttr(dt.entity.host, “tags”), array($ManagementZone)) and&nbsp; &nbsp; in(entityAttr(dt.entity.host, “osType”), array($OS))&nbsp; }| lookup&nbsp;[fetch dt.entity.host&nbsp; &nbsp; &nbsp; | fieldsAdd entity.name], sourceField:dt.entity.host, lookupField:id| fieldsAdd disk.name = entityName(dt.entity.disk)| fieldsRename&nbsp; Server = lookup.entity.name| sort Disk\_Used desc

---

<div class="post-metadata">

**Author:** ![marco\_irmer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marco_irmer/32/3038_2.png) [@marco\_irmer](https://community.dynatrace.com/u/marco_irmer)\
**Post date:** [May 21, 2025, 10:28pm UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743/2 "2025-05-21T22:28:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [May 22, 2025, 12:03am UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743/3 "2025-05-22T00:03:45Z")

</div>

[@mrigau](https://community.dynatrace.com/user/67787)&nbsp;If your network drives have a format something like “\\NAME\SOFTWARE” you can add filter to exclude . Below is an example

```markup
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)

```

---

<div class="post-metadata">

**Author:** ![mrigau](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mrigau](https://community.dynatrace.com/u/mrigau)\
**Post date:** [May 22, 2025, 10:42pm UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743/4 "2025-05-22T22:42:13Z")

</div>

What about this metric?:&nbsp;&nbsp;storage.disk.fstype  
I can probably filter by the type of Linux disk to get this done.&nbsp; How can I incorporate a lookup to read this disk type?

---

<div class="post-metadata">

**Author:** ![GerardJ](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gerardj/32/154_2.png) [@GerardJ](https://community.dynatrace.com/u/GerardJ)\
**Post date:** [May 23, 2025, 6:56am UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743/5 "2025-05-23T06:56:59Z")

</div>

Hi  
You can try adding the ‘filesystemType’ and then filter on it :

```python
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…

---

<div class="post-metadata">

**Author:** ![mrigau](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mrigau](https://community.dynatrace.com/u/mrigau)\
**Post date:** [May 23, 2025, 3:21pm UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743/6 "2025-05-23T15:21:52Z")

</div>

Gerald,&nbsp; thanks,&nbsp; this will work for my case.&nbsp; 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.&nbsp; Thanks for the recommendations.

---

<div class="post-metadata">

**Author:** ![rguardiola](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@rguardiola](https://community.dynatrace.com/u/rguardiola)\
**Post date:** [November 13, 2025, 2:35pm UTC](https://community.dynatrace.com/t/dql-to-display-local-disk-usage-on-dashboards-windows-linux/51743/7 "2025-11-13T14:35:15Z")

</div>

I know this thread is a bit old, but I was runnig on some problem. I found an attibute “remoteDiskId” in dt.entity.disk dimension, which is null when disk is local. Checked against many cenarius and worked fine.  
Here my query for a Donut visualization:timeseries { dskUsed = max(dt.host.disk.used,&nbsp; scalar: true),&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dskFree = max(dt.host.disk.avail, scalar: true) },&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; interval: 1m, by: {&nbsp; dt.entity.host, dt.entity.disk }| fieldsAdd Disco = entityName(dt.entity.disk),&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; **remoteDiskId = entityAttr(dt.entity.disk, “remoteDiskId”)**| lookup [fetch dt.entity.host | expand managementZones&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | fields id, managementZones, dt.entity.vmware\_datacenter = asString( belongs\_to[dt.entity.vmware\_datacenter] )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | fieldsAdd DC = entityName( dt.entity.vmware\_datacenter )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | filter DC == “DCDF” or DC == “DCSP”], sourceField:dt.entity.host, lookupField:id, prefix:“mz.”| filter mz.managementZones == $Filtro&nbsp;&nbsp; &nbsp; &nbsp;and (mz.DC == “DCDF” or mz.DC == “DCSP”)&nbsp;&nbsp; &nbsp; &nbsp;**and isNull(remoteDiskId)**| fieldsRemove mz.id, mz.dt.entity.vmware\_datacenter, dt.entity.host, interval, timeframe| summarize a=sum(dskUsed), b=sum(dskFree)| fieldsAdd c=array( array(“Usado”, a), array(“Livre”, b)) | fieldsRemove a, b | expand c| fields Tipo=c[0], Valor=c[1]
