BSD periodic(8) - use for ZFS monitoring/scrubs?



  • Saw this post over on reddit about FreeBSD periodic(8) which comes out of the box ready to do various nice things. One of them is to check and scrub ZFS pools and report errors via email/syslog. Rather than re-invent the wheel, is there a way to wire this up on 2.4.x ?

    I see the relevant bits and configs are already in place on my system...

    /etc/defaults/periodic.conf
    /etc/periodic/daily/404.status-zfs
    /etc/periodic/daily/800.scrub-zfs
    

    but when I try to run

    # periodic daily
    

    I'm greeted with eval: mail: not found
    (It does seem to run and churn through a bunch of things though)

    I assume I need to set some variable or adjust a conf file since mail does not exist on a default install. Maybe it can be made to use mail.php somehow? I saw this note about installing sendmail (but it's from old docs on 2.3 so I am reluctant to even try). Since it's there in FreshPorts, seems like I could try pkg install sendmail+tls+sasl2 and dive down a rabbit hole...

    any tips?


  • Rebel Alliance Developer Netgate

    We have disabled some things (like mail) that periodic wants, but I'm not sure we've taken a look at that lately to see if any of it is viable to bring back. The cron entries are disabled for periodic as well.

    We do like to re-use what we can in FreeBSD where possible, so it would most likely be that path we take when we get around to rigging up ZFS support. Though we may not use periodic directly but the scripts it has. Too early to say.



  • Thanks for the reply Jim. Sounds like this is pretty far off. I guess for now I'll just make a simple script and cron entry to scrub every now and then and dump the results into syslog.