diff --git a/uptimekuma.sh b/uptimekuma.sh index 3a68a48..5d03456 100644 --- a/uptimekuma.sh +++ b/uptimekuma.sh @@ -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/" -PUSH_KEY="" -DISK_FULL_ALERT_PERCENT_THRESHOLD=85 -CPU_USAGE_PERCENT_THRESHOLD=60 -MEM_USAGE_PERCENT_THRESHOLD=80 +PUSH_KEY="" # The random code in the URL generated by Uptime Kuma +ENABLE_ZFS_MONITOR=1 # Set to 0 if you aren't using ZFS +DISK_FULL_ALERT_PERCENT_THRESHOLD=85 # Alerts if any filesystem is fuller than this +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 -echo -n "Checking ZFS health: " -ZFS_STATUS=$(zpool status -x | grep -q "all pools are healthy" && echo "OK" || zpool status -x) -echo "$ZFS_STATUS" +ZFS_STATUS="OK" +if [[ $ENABLE_ZFS_MONITOR == 1 ]]; then + echo -n "Checking ZFS health: " + ZFS_STATUS=$(zpool status -x | grep -q "all pools are healthy" && echo "OK" || zpool status -x) + echo "$ZFS_STATUS" +fi # Disk usage echo -n "Checking disk usage: "