Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support to get rotational of the disk. #2956

Open
zhucan opened this issue Mar 15, 2024 · 3 comments · May be fixed by #3022
Open

feat: support to get rotational of the disk. #2956

zhucan opened this issue Mar 15, 2024 · 3 comments · May be fixed by #3022

Comments

@zhucan
Copy link

zhucan commented Mar 15, 2024


		content, err := os.ReadFile(fmt.Sprintf("/sys/block/%s/queue/rotational", dev))
		if err != nil {
			level.Debug(c.logger).Log("msg", "Failed to get sys block device queue stats", "err", err)
		}
		rotational := strings.Replace(string(content), "\n", "", -1)
		i, err := strconv.Atoi(rotational)
@tjhop
Copy link
Contributor

tjhop commented Mar 15, 2024

For what it's worth, there is already code in place to get rotational info as reported by udev:

udevIDATARotationRateRPM: {
desc: prometheus.NewDesc(prometheus.BuildFQName(namespace, diskSubsystem, "ata_rotation_rate_rpm"),
"ATA disk rotation rate in RPMs (0 for SSDs).",
[]string{"device"},
nil,
), valueType: prometheus.GaugeValue,
},

However, I don't have that metric available on any of the systems I personally own, and I do have rotational info in sysfs for my disks. I would also be in favor of a sysfs based method for collecting rotational info, but it might be better suited to live in github.com/prometheus/procfs, in my opinion

@tjhop
Copy link
Contributor

tjhop commented Mar 15, 2024

Turns out it already does exist in procfs and I forgot about it!

https://pkg.go.dev/github.com/prometheus/[email protected]/blockdevice#BlockQueueStats

Seems we would just need to utilize it

@SuperQ
Copy link
Member

SuperQ commented May 21, 2024

Yes, this seems like it would be easy to add to the diskstats collector.

rexagod added a commit to rexagod/node_exporter that referenced this issue May 23, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
@rexagod rexagod linked a pull request May 23, 2024 that will close this issue
rexagod added a commit to rexagod/node_exporter that referenced this issue Aug 13, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
rexagod added a commit to rexagod/node_exporter that referenced this issue Aug 13, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
rexagod added a commit to rexagod/node_exporter that referenced this issue Sep 22, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
rexagod added a commit to rexagod/node_exporter that referenced this issue Sep 22, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
rexagod added a commit to rexagod/node_exporter that referenced this issue Sep 22, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
rexagod added a commit to rexagod/node_exporter that referenced this issue Oct 20, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
rexagod added a commit to rexagod/node_exporter that referenced this issue Oct 20, 2024
Add metric to indicate if a device is rotational or not.

Fixes: prometheus#2956
Signed-off-by: Pranshu Srivastava <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants