From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: waxhead@dirtcellar.net, linux-btrfs@vger.kernel.org
Subject: Re: libbrtfsutil questions
Date: Mon, 23 Apr 2018 14:39:47 -0400 [thread overview]
Message-ID: <acb2d254-d5d0-4e2c-f661-ab22baeafa39@gmail.com> (raw)
In-Reply-To: <003ad066-7544-e452-90ac-b2cad9cc1d06@dirtcellar.net>
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
prev parent reply other threads:[~2018-04-23 18:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 18:25 libbrtfsutil questions waxhead
2018-04-23 18:39 ` Austin S. Hemmelgarn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acb2d254-d5d0-4e2c-f661-ab22baeafa39@gmail.com \
--to=ahferroin7@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=waxhead@dirtcellar.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox