On 10/08/18 17:46, Hans van Kranenburg wrote: <snip>
fs.devices() also looks for dev_items in the chunk tree: https://github.com/knorrie/python-btrfs/blob/master/btrfs/ctree.py#L481 So, BOOM! you need root. Or just start a 0, ignore errors and start trying all devids until you found num_devices amount of them that work, yolo.
Since I need to walk /sys/fs/btrfs/ anyway I *think* I can just look at the entries in /sys/fs/btrfs/<fsid>/devices/ and query them all directly. The skeleton btrfs_exporter already responds to http requests and returns dummy metrics, using the official python client library. I've found a nice little python sysfs scraper and now only need to figure out how best to map the btrfs info in sysfs to useful metrics. The privileged access issue would only have come into play much later, but it seems I can avoid it after all, which is great. I'm also (re-)learning python in the process, so that's the actual thing slowing me down.. -h
