DataDog / datadog-agent

Main repository for Datadog Agent
https://docs.datadoghq.com/
Apache License 2.0
2.73k stars 1.17k forks source link

[BUG] Disk integration `system.disk.read_time` `write_time` `system.io.await` missing mount name #27173

Open CrashLaker opened 2 days ago

CrashLaker commented 2 days ago

Hi all, idk if this is a bug or a FR. if not. apologies

Agent Environment version 7.52.1

Describe what happened: I've a dashboard where I monitor my disk pools. image

I have many mounts like image

the way i setup the panels are like this image

so I use the mount name /mnt/data-YRLB for disk size and /dev/sdd1 for io latency.

and every time the host reboots the device sd* scrambles to another mount. since they're bounded by their UUIDs everything works fine but the dashboard gets out of sync. image

Describe what you expected: I'd expect to use the mount name in metrics like system.disk.read_time, system.disk.write_time, system.io.await like in system.disk.used

Steps to reproduce the issue: start agent and enable disk monitoring

Additional environment details (Operating System, Cloud provider, etc): centos 8 on bare metal mac mini

thanks

regards,c.

CrashLaker commented 2 days ago

well not ideal but i've edited /opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/disk/disk.py

    def collect_latency_metrics(self):
        output = os.popen("mount").read().strip()
        # /dev/sdi1 on /mnt/data-3RJT type ext4 (rw,relatime)
        mapmount = {}
        for line in output.split("\n"):
            try:
                l = line.split(" ")
                if len(l) >= 3 and l[1] == "on":
                    mapmount[l[0]] = l[2]
            except:
                pass

...

                dev_disk_name = f"/dev/{disk_name}"
                if dev_disk_name in mapmount:
                    metric_tags.append('device:{}'.format(mapmount[dev_disk_name]))
                else:
                    metric_tags.append('device:{}'.format(disk_name))

image

maybe a feature request.

regards,c