DQL query on disk free space

Hi Team,

We require DQL query on disk free space with OS type.

Information require through dql query --

disk free space for /opt/ directory
os type-like Linux ubuntu , AIX

Thanks in advance !

Hi @akashsaini,

You can try this query :

timeseries avg(dt.host.disk.free), by: { dt.entity.host, dt.entity.disk }
| fieldsAdd dt.entity.host.name = entityName(dt.entity.host)
| fieldsAdd dt.entity.disk.name = entityName(dt.entity.disk)
| lookup [fetch dt.entity.host
  | fieldsAdd osType2=osType], sourceField:dt.entity.host, lookupField:id, fields:{osType2}
| fieldsAdd DiskFree = arrayAvg(`avg(dt.host.disk.free)`)
| fieldsKeep dt.entity.host.name,dt.entity.disk.name, osType2, DiskFree

Let me know if it works

Thanks Gbaudart,

query perfectly working.

Please confirm the disk free space in GB ?

Hi @akashsaini,
Normally, the unit will match the magnitude of your result. You can change the unit in the query display options.

I am creating a Dashboad to pull the disk usage for windows and Linux Servers, for example in windows server (C. D. e) and Linux Server ,(/tmp, /root) can you please advise. should i use Query based or Metric based.

the following query works for percentage based, i would like to get the GB how much used and how much free.

timeseries avg(dt.host.disk.free), by: { dt.entity.host, dt.entity.disk }
| fieldsAdd dt.entity.host.name = entityName(dt.entity.host)
| fieldsAdd dt.entity.disk.name = entityName(dt.entity.disk)
| lookup [fetch dt.entity.host
| fieldsAdd osType2=osType], sourceField:dt.entity.host, lookupField:id, fields:{osType2}
| fieldsAdd DiskFree = arrayAvg(`avg(dt.host.disk.free)`)
| fieldsAdd DiskUsage = 100 - DiskFree
| fieldsKeep dt.entity.host.name, dt.entity.disk.name, osType2, DiskFree, DiskUsage

| sort DiskUsage asc

Hi @manog1978

You can use this query for available space in value.

timeseries max(dt.host.disk.avail), by: { dt.entity.host, dt.entity.disk }| fieldsAdd dt.entity.host.name = entityName(dt.entity.host)| fieldsAdd dt.entity.disk.name = entityName(dt.entity.disk)| lookup [fetch dt.entity.host| fieldsAdd osType2=osType], sourceField:dt.entity.host, lookupField:id, fields:{osType2}| fieldsAdd DiskFree = arrayAvg(`max(dt.host.disk.avail)`)| fieldsKeep dt.entity.host.name,dt.entity.disk.name, osType2, DiskFree