Add ZFS toggle setting, add comments

This commit is contained in:
Skylar Ittner 2025-08-31 16:27:13 -06:00
parent 881f68c2d2
commit 6c0afb437a

View File

@ -1,13 +1,24 @@
#!/bin/bash
# Check various system health statistics and push them to Uptime Kuma
# Triggers a "down" alert if a stat is above the threshold,
# and sends info about what's wrong
# Also supports checking ZFS pool health
API_URL="https://status.netsyms.net/api/push/" API_URL="https://status.netsyms.net/api/push/"
PUSH_KEY="" PUSH_KEY="" # The random code in the URL generated by Uptime Kuma
DISK_FULL_ALERT_PERCENT_THRESHOLD=85 ENABLE_ZFS_MONITOR=1 # Set to 0 if you aren't using ZFS
CPU_USAGE_PERCENT_THRESHOLD=60 DISK_FULL_ALERT_PERCENT_THRESHOLD=85 # Alerts if any filesystem is fuller than this
MEM_USAGE_PERCENT_THRESHOLD=80 CPU_USAGE_PERCENT_THRESHOLD=60 # Alerts if CPU usage averages greater than this across 5 minutes
MEM_USAGE_PERCENT_THRESHOLD=80 # Alerts if RAM usage rises over this percentage, ZFS ARC counts as used
# ZFS health # ZFS health
ZFS_STATUS="OK"
if [[ $ENABLE_ZFS_MONITOR == 1 ]]; then
echo -n "Checking ZFS health: " echo -n "Checking ZFS health: "
ZFS_STATUS=$(zpool status -x | grep -q "all pools are healthy" && echo "OK" || zpool status -x) ZFS_STATUS=$(zpool status -x | grep -q "all pools are healthy" && echo "OK" || zpool status -x)
echo "$ZFS_STATUS" echo "$ZFS_STATUS"
fi
# Disk usage # Disk usage
echo -n "Checking disk usage: " echo -n "Checking disk usage: "