* libbrtfsutil questions
@ 2018-04-23 18:25 waxhead
2018-04-23 18:39 ` Austin S. Hemmelgarn
0 siblings, 1 reply; 2+ messages in thread
From: waxhead @ 2018-04-23 18:25 UTC (permalink / raw)
To: linux-btrfs
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?
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: libbrtfsutil questions
2018-04-23 18:25 libbrtfsutil questions waxhead
@ 2018-04-23 18:39 ` Austin S. Hemmelgarn
0 siblings, 0 replies; 2+ messages in thread
From: Austin S. Hemmelgarn @ 2018-04-23 18:39 UTC (permalink / raw)
To: waxhead, linux-btrfs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-23 18:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 18:25 libbrtfsutil questions waxhead
2018-04-23 18:39 ` Austin S. Hemmelgarn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.