ZFS Scrub Cron Task - Notifications?

Started by rkubes, September 17, 2023, 09:00:42 PM

Previous topic - Next topic
September 17, 2023, 09:00:42 PM Last Edit: September 18, 2023, 05:24:17 AM by rkubes
My hardware is a simple single drive mini-PC, thus during a ZFS scrub, there wouldn't be any opportunity for it to correct data - just potentially identify bad data (failed checksums).

My question is does setting this Cron task provide any notifications if failures are found? Or would it just fail silently in the background and not provide benefit?

Even if there's a Monit alert that I can use in tandem that would still suffice. I just want to avoid having to log in specifically to look for errors, I'd want "proactive" alerting.

Any assistance or feedback would be greatly appreciated.

Edit:
For now, I've added a script that will run "zpool status -x" and check the output for the text that all pools are healthy. If it says that, then it returns 0, else it returns an error code.

Then I added a "custom" Monit alert for non-zero status that runs this script. This could potentially be superfluous if the scrub cron job would provide some kind of error or alert anyway.

I'm not going to mark this as "solved" yet, as I don't know if this is the right approach. I don't know the
way to simulate corruption, and don't want to spin up a test environment just to try to test the Monit service.

If you look at the configutil files you can see what the actual command run for the scrub is and then work out what it returns.  I see a checksum failed event in the monit options but I'm not sure if that's referring to zfs or not.

I need to get around to actually setting up monit and diffing into it's config.  Unfortunately, it hasn't made it to the top of my todo list yet.