I'm not sure if your requirement is specific to ZFS or of more general nature and I don't know what OS you are using.
On Linux, there is Inotify that will trigger callbacks when files are accessed/changed.
There is a Perl interface: Linux::Inotify2, though I don't know if it is able to handle directories recursively.
Greetings, -jo
$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
| [reply] |
| [reply] |
Ok, so let me rephrase my question: How do I make a perl program that listens for whenever `zpool`and `zfs` command is used and saves it in database? Thanks in advance. | [reply] |
EDIT: whenever `zpool` and `zfs`is used in the terminal
| [reply] |
The easiest way is to rename the zfs and zpool commands to something else (zfs.org?) and name your new programs zfs and zpool.
Alternatively, set up shell aliases for the users using these commands.
Alternatively, learn about what APIs ZFS offers to know about what zfs and zpool do or change, and listen to these API calls.
| [reply] [d/l] [select] |
It's OP here. Suppose I'm on Linux using ext4 and do `resize2fs` to either shrink or grow the filesystem, how does my perl program capture on the fly how much the filesystem was shrank or grown into? I'm thinking I'd have to make my program listen/watch the Journalling API calls (https://www.kernel.org/doc/html/v4.19/filesystems/index.html#the-linux-journalling-api), right? What module would I use to listen/watch the API calls constantly so that I can capture the information from the journal instantaneously as soon as the shrink or grow is done? Thanks in advance. | [reply] |