diff --git a/health-check.sh b/health-check.sh index 411ef4c..779549c 100755 --- a/health-check.sh +++ b/health-check.sh @@ -62,16 +62,16 @@ check_disk() { ok "Disk usage at ${pct}% on $mount" fi done < <(df -h | awk 'NR>1' | grep -v ' /dev' | grep -v ' /sys' | grep -v ' /proc' | grep -v ' /run' | grep -v ' /snap' | grep -v 'overlay2' | grep -v 'docker') - local used_kb total_kb total_pct - used_kb=$(df --block-size=1K / | awk 'NR==2 {print $3}') - total_kb=$(df --block-size=1K / | awk 'NR==2 {print $2}') - total_pct=$(( used_kb * 100 / total_kb )) + local used_human total_human total_pct + used_human=$(df -h / | awk 'NR==2 {print $3}') + total_human=$(df -h / | awk 'NR==2 {print $2}') + total_pct=$(df / | awk 'NR==2 {print $5}' | tr -d '%') if [ "$total_pct" -ge 90 ]; then - fail "Total disk usage at ${total_pct}% (root filesystem) — critically low" + fail "Total disk usage ${used_human} of ${total_human} — critically low" elif [ "$total_pct" -ge 80 ]; then - warn "Total disk usage at ${total_pct}% (root filesystem)" + warn "Total disk usage ${used_human} of ${total_human}" else - ok "Total disk usage at ${total_pct}% (root filesystem)" + ok "Total disk usage ${used_human} of ${total_human}" fi }