Disk free (Linux / macOS) bash
Reports free GB and used % for the root filesystem. Trivial cron one-liner; pair with capture.value.
Placeholders only. Before running, replace
YOUR_URL with your capture endpoint's POST URL
.
(Open this page from your capture object to have these auto-filled.)
#!/bin/bash
# disk-free.sh — free space on /
URL='YOUR_URL/disk'
FREE_GB=$(df -BG / | awk 'NR==2 {gsub("G","",$4); print $4}')
TOTAL_GB=$(df -BG / | awk 'NR==2 {gsub("G","",$2); print $2}')
USED_PCT=$(df / | awk 'NR==2 {gsub("%","",$5); print $5}')
curl -fsS -m 15 -H 'Content-Type: application/json' \
--data-raw "{\"hostname\": \"$(hostname)\", \"free_gb\": $FREE_GB, \"total_gb\": $TOTAL_GB, \"used_pct\": $USED_PCT}" \
"$URL"
Recommended pairing
Add a capture.value check to this capture object.
json_path = free_gb, op = <, threshold = 10.
What is the filename?
disk-free.sh — this is the suggested name for the downloaded file. Rename freely if you prefer.
site1.erralert.com