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

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:

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 },  filter: {    matchesValue(entityAttr(dt.entity.host, “tags”), array($ManagementZone)) and    in(entityAttr(dt.entity.host, “osType”), array($OS))  }| lookup [fetch dt.entity.host      | fieldsAdd entity.name], sourceField:dt.entity.host, lookupField:id| fieldsAdd disk.name = entityName(dt.entity.disk)| fieldsRename  Server = lookup.entity.name| sort Disk_Used desc

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?

@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)

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?

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…

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.

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,  scalar: true),              dskFree = max(dt.host.disk.avail, scalar: true) },         interval: 1m, by: {  dt.entity.host, dt.entity.disk }| fieldsAdd Disco = entityName(dt.entity.disk),             remoteDiskId = entityAttr(dt.entity.disk, “remoteDiskId”)| lookup [fetch dt.entity.host | expand managementZones          | fields id, managementZones, dt.entity.vmware_datacenter = asString( belongs_to[dt.entity.vmware_datacenter] )          | fieldsAdd DC = entityName( dt.entity.vmware_datacenter )          | filter DC == “DCDF” or DC == “DCSP”], sourceField:dt.entity.host, lookupField:id, prefix:“mz.”| filter mz.managementZones == $Filtro      and (mz.DC == “DCDF” or mz.DC == “DCSP”)      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]