Generate/send an email when storages hit a certain usage percentage?

I found for example this for zfs:
https://louwrentius.com/the-zfs-event-daemon-on-linux.html

There seems to be an event daemon that can also send you emails.
I haven’t checked whether it includes a notification about space usage, but I guess there should be something.

For the container itself, I guess there are two possibilities:

  1. The container can check from inside (I am sure, some scripts or even programs for that already exist (because in the end a container is nearly like a normal system))
  2. LXD can show quotas from the outside and that could be read out by a script.
    Interesting coincidence: