I would like to know if there is a way to access the ZFS api (preferably from python but C is fine too). My goal is to write some tools that will monitor my pools but would definitely like to not to have to parse output of zpool command.
There are java bindings to the libzfs on Solaris. AFAIK they haven't been ported (yet) to BSD or Linux. However, it might not be too big of an endeavour to start that, since it is Java after all, it could be relatively portable already.
IIRC the Java API was used for Solaris 10's ZFS Management Web Interface.
Also, I've heard rumors about a Python API (perhaps it was used in the new-style Autosnapshot service by Tim Foster?).
Here is a link to the latest bits I knew how to find
Additionally if you are using OpenZFS (ie. ZFS on Illumos, FreeBSD, Linux, Mac OS X, etc.) there is now libzfs_core as alternative to libzfs (which was iirc never a stable API). See: http://blog.delphix.com/matt/2012/01/17/the-future-of-libzfs/
Well, it may not be a full answer but there is the libzfs library in /usr/lib
. The strange thing is that headers for libzfs (zfs.h and etc.) aren't installed and only present in kernel sources.
So, if you need to develop something using libzfs, you may try to install kernel sources and include needed headers from there.
© 2022 - 2024 — McMap. All rights reserved.