5

I couldn't access my media drive the other day. SSH'd into my media server to see what was up. ZFS pool wasn't even mounted. When I got it running again, I saw that it was degraded and one of the harddrives was UNAVAIL.

Got it fixed now, but I'd like an earlier warning if this happens again. Can I get it to send me an email when a harddrive goes offline/degraded/unavailable?

Presently running ZFS 0.6.5.6 on Ubuntu 16.04.2.

mpen
  • 423
  • 1
  • 6
  • 15

1 Answers1

5

You can (and should) monitor your pool via zed, the ZFS event daemon

Alternatively, you can configure cron to regularly run zpool status -x, sending email when some output is printed. For example:

#!/bin/bash
exit_code=0
/usr/sbin/zpool status -x | grep -v "all pools are healthy" && exit_code=1
exit $exit_code
shodanshok
  • 47,711
  • 7
  • 111
  • 180
  • 1
    https://medium.com/@arunderwood/configuring-zfs-event-daemon-zed-on-ubuntu-16-04-ee9ac2623c86 Looks like what I want. Will try this soon, thanks! – mpen Oct 05 '19 at 08:57