This is a script I made to check the health of the ZFS pools on my Ubuntu server and send a notification with a summary to a Discord server channel (see image of example notification below) I have made for my servers. I borrowed and modified some parts for the actual ZFS health check from this Gist. The script checks ZFS pools overall condition, capacity, errors and time since last scrub. If an issue is detected with a pool a role on the Discord channel is pinged.
This script is only tested on Ubuntu Server 20.04.
Copy the two bash files to a Linux server with ZFS pools and modify as required based on distro/version. Fill inn the Discord variables in the discord-variables.sh file.