I’m using sanoid and syncoid to make snapshots and sync them to backup pools. I want to monitor those snapshots and I see that sanoid has built in monitoring functions that work with nagios. I’m using healthchecks.io to monitor most of my homelab. So I wrote this bash script to monitor my pools and snapshots. Any suggestions?
#!/bin/bash
output_snapshots=$(/usr/sbin/sanoid --monitor-snapshots)
output_capacity=$(/usr/sbin/sanoid --monitor-capacity)
output_health=$(/usr/sbin/sanoid --monitor-health)
if [[ $output_snapshots == OK* ]] && [[ $output_capacity == OK* ]] && [[ $output_health == OK* ]]; then
curl -m 10 --retry 5 https://healthchecks.io/ping/xxxxxxxxxxxxx
else
echo "One or more checks did not return OK."
curl -m 10 --retry 5 https://healthchecks.io/ping/xxxxxxxxxxxxx/fail