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

Is there a way for me to set up that if lxc storages that I’ve created will hit me up with an email if one of them goes above a certain limit? Lets say if 70% storage is used in any of the containers, so I know I have to take action. In this current case, I am using zfs storage for all of them.

I’d assume this is not a default function, but worth asking. Maybe someone here is using a similar approach.

I found for example this for zfs:

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: