From 3a95c5d455bc37c9967983744c50c1745312c11f Mon Sep 17 00:00:00 2001 From: DBS-ST-VIT Date: Wed, 10 Jan 2024 14:24:38 +0100 Subject: [PATCH] diskstats: ignore zram devices on linux systems by default Signed-off-by: DBS-ST-VIT --- collector/diskstats_linux.go | 2 +- collector/diskstats_linux_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/diskstats_linux.go b/collector/diskstats_linux.go index ffda6ae421..ed5d044a61 100644 --- a/collector/diskstats_linux.go +++ b/collector/diskstats_linux.go @@ -36,7 +36,7 @@ const ( // See also https://www.kernel.org/doc/Documentation/block/stat.txt unixSectorSize = 512.0 - diskstatsDefaultIgnoredDevices = "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$" + diskstatsDefaultIgnoredDevices = "^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$" // See udevadm(8). udevDevicePropertyPrefix = "E:" diff --git a/collector/diskstats_linux_test.go b/collector/diskstats_linux_test.go index f0d7499be0..8e969c3e3a 100644 --- a/collector/diskstats_linux_test.go +++ b/collector/diskstats_linux_test.go @@ -53,7 +53,7 @@ func TestDiskStats(t *testing.T) { *sysPath = "fixtures/sys" *procPath = "fixtures/proc" *udevDataPath = "fixtures/udev/data" - *diskstatsDeviceExclude = "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$" + *diskstatsDeviceExclude = "^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$" testcase := `# HELP node_disk_ata_rotation_rate_rpm ATA disk rotation rate in RPMs (0 for SSDs). # TYPE node_disk_ata_rotation_rate_rpm gauge node_disk_ata_rotation_rate_rpm{device="sda"} 7200