On 2018-04-23 14:25, waxhead wrote:
Howdy!

I am pondering writing a little C program that use libmicrohttpd and libbtrfsutil to display some very basic (overview) details about BTRFS.

I was hoping to display the same information that'btrfs fi sh /mnt' and 'btrfs fi us -T /mnt' do, but somewhat combined. Since I recently just figured out how easy it was to do svg graphics I was hoping to try to visualize things a bit.

What I was hoping to achieve is:
- show all filesystems
- ..show all devices in a filesystem (and mark missing devices clearly)
- ....show usage and/or allocation for each device
- ....possibly display chunks as blocks (like old defrag programs) where the brightness indicate how utilied a (meta)data chunk is.
- ....possibly mark devices with errors ( 'btrfs de st /mnt' ).

The problem is ... I looked at libbtrfsutil and it appears that there is mostly sync + subvolume/snapshot stuff in there. > So my question is: Is libbtrfsutil the right choice and intended to at some point (in the future?) supply me with the data I need for these things or should I look elsewhere?
I believe that the intent is for libbtrfsutil to cover pretty much everything (AIUI, that's supposed to become the public API for BTRFS, with the CLI tools just being wrappers for that). However, as you've found out, it's not really there yet.

If you've got some experience with Python and don't mind putting a bit more work in learning how things work at a low level in BTRFS, the Python interface maintained by Hans van Kranenburg and found at [1] may be of some interest. I would imagine it shouldn't be much more difficult to wire the Python http.server module up to that than it would be to wire libmicrohttpd up to a C library, and it would give the advantage that you could use a nice templating language like Jinja2 to format everything.

PS! This a completely private project for my own egoistic reasons. However if it turns out to be useful and the code is not too embarrassing I am happy put the code into public domain ... if it ever gets written.... :S
For what it's worth, I think the idea is great. Especially if it could be made to return the data in a JSON format, as that would then make it trivial to use for integrating most existing system monitoring infrastructure with BTRFS.


[1] https://github.com/knorrie/python-btrfs
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to