Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upbtrfs stats collector #1100
btrfs stats collector #1100
Comments
|
Do you know where in /proc or /sys this information is available? |
|
I previously looked into writing an exporter for btrfs but got sidetracked. The information exposed |
|
I see a few Go libraries for handling btrfs. They seem focused around sub volume management. Just a reminder about implementation requirements here:
|
At least the dev stats/error information currently requires privileged access. |
|
Reading device stats does not require root, the only part that does is the reset. https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git/tree/fs/btrfs/ioctl.c?h=v4.18#n4692 |
|
Hi David,
..and yet it doesn't work for me on 4.18.12 with -progs v4.17.1. end of strace:
Both btrfs_ioctl_tree_search{_v2} unconditionally check for CAP_SYS_ADMIN. |
|
Something is calling the search tree ioctl that's not accessible. |
|
For the peanut gallery: I tracked the privilege issue down to difference in behaviour of btrfs-progs However, invoking the ioctl programmatically on a mount point will work (here /tmp/test is loop0):
So at least for accessing the device stats/errors programmatically no privilege is necessary |
|
It would be useful if it could expose metrics relating to the usage too: |
|
+1 for @Andysimcoe btrfs metrics list. Any idea when this might start to emerge? |
|
Adding more procfs/sysfs parsing should be added to https://github.com/prometheus/procfs. Once we have parsing in the library, we can add it to the exporter. |
|
After having a btrfs system crash because the metadata allocation ran full, I'd suggest also exposing the data from Update: this looks like what I'm looking for: https://github.com/knorrie/python-btrfs/blob/master/examples/btrfs-fi-df.py I might look into creating a separate exporter for this. |
|
Update on this:
I started a standalone btrfs_exporter based on the official python client and python-btrfs, but stopped because it was horrible to develop. I don't really know python and the official client library is not only super weird and fragile, it also leaks memory. It took me less than three days to get somewhere in C++ (using prometheus-cpp) and I already have more working than before, plus it is faster, doesn't leak memory and uses 1/10th the disk space/memory. |
|
@hhoffstaette Which is the official python client? |
|
|
See #1200, apparently some stats are available in procfs. Ideally somebody would add support for that to procfs and we could have a 'real' collector. |
Resolves prometheus#1100 Signed-off-by: Silke Hofstra <silke@slxh.eu>
Resolves prometheus#1100 Signed-off-by: Silke Hofstra <silke@slxh.eu>
Resolves prometheus#1100 Signed-off-by: Silke Hofstra <silke@slxh.eu>
Resolves prometheus#1100 Signed-off-by: Silke Hofstra <silke@slxh.eu>
Resolves prometheus#1100 Signed-off-by: Silke Hofstra <silke@slxh.eu>
Resolves prometheus#1100 Signed-off-by: Silke Hofstra <silke@slxh.eu>
Enhancement
Please develop a collector of BTRFS stats. They look like this:
Documentation: https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-device#DEVICE_STATS