You can do this with devd on FreeBSD since forever. If only people read the manuals for their operating systems…
It’s funny you should mention that because you can on illumos too, with a facility that has existed for more than ten years: syseventadm.
As I recall from speaking to some early adopters of ZOL at one of the ZFS developer summits, ZED was created to provide the same functionality that appliance vendors were already getting from sysevents.
FreeBSD also has zfsd(8) for this.
From the zfsd(8) man page:
zfsd attempts to resolve ZFS faults that the kernel can't resolve by itself.
It listens to devctl(4) events, which are how the kernel notifies userland
of events such as I/O errors and disk removals. zfsd attempts to resolve
these faults by activating or deactivating hot spares and onlining offline
Take a look at entire man page online here: http://man.freebsd.org/zfsd
This is quite intriguing. I’m currently in the process of building a local NAS and I’m testing ZFS on my machine. This opens up a lot of IFTTT possibilities.