-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add Label to disk plugin #12594
Comments
@izenn it looks like name from the
Is that what you are after? |
yes it is -- i believe i have figured out a way to get it into the disk plugin, but would appreciate a second set of eyes to see if what i did makes sense |
Thanks for working on this @izenn! Happy to see and have further conversation in a PR as well. Since you are effectively taking the partition device and stripping the leading
|
which would give:
both replace and filepath give the same results. Is strings.replace/replaceall faster/lighter than filepath? i think strings.Replace would probably be safer than ReplaceAll just in case there is a second /dev/ in there somewhere. |
I picked it only to be consistent
replace with a 1 is fine |
removed the filepath and changed the disk.Label line to: let me know if you can think of anything else, otherwise i'll submit the pull request tomorrow |
Please do, it will have to be reviewed by myself and srebhan so putting it up sooner rather than later is good :) |
submitted PR #12620 |
I'm going to re-open the issue till we land your PR. Thanks again! |
initial tests look good, i'll deploy it to some of my development instances tomorrow to have a better test |
Thanks for giving it a shot! |
Use Case
working with lvm and the disk plugin, filesystem usage is reported using the dm-# style device names. Per the diskio plugin this device is near-meaningless. In order to track disk usage through influxDB i would like the disk label added to the disk output.
Looking at the source of the code where the disk input plugin gets the disk info from (https://github.com/shirou/gopsutil/blob/master/disk/disk.go) the code to get the disk label looks to be there, it would just need to be folded into the disk.PartitionStat output:
Expected behavior
it would be nice to have output from the disk plugin like this:
`{"device":"/dev/dm-0","mountpoint":"/","fstype":"xfs","opts":["rw","relatime"],"label":"rhel-root"}
instead of the current:
{"device":"/dev/dm-0","mountpoint":"/","fstype":"xfs","opts":["rw","relatime"]}
Actual behavior
I learned just enough go to be able to get a proof of concept to work, but i do not know struct's well enough to combine everything:
Additional info
No response
The text was updated successfully, but these errors were encountered: