Update kuma-push.sh

This commit is contained in:
Jordan Wages 2025-08-01 01:42:28 -05:00
commit b3d64581f0

View file

@ -10,14 +10,14 @@ BASE="https://status.jordanwages.com/api/push"
CURL_OPTS=(--silent --show-error --max-time 4) CURL_OPTS=(--silent --show-error --max-time 4)
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Small random delay so many VMs dont hammer Kuma at the same second # Small random delay so many VMs don't hammer Kuma at the same second
sleep $(( RANDOM % 5 )) # 0-4 s sleep $(( RANDOM % 5 )) # 0-4 s
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
push() { # id status msg ping push() { # id status msg ping
curl "${CURL_OPTS[@]}" \ curl "${CURL_OPTS[@]}" \
"${BASE}/${1}?status=${2}&msg=${3// /%20}&ping=${4}" \ "${BASE}/${1}?status=${2}&msg=${3// /%20}&ping=${4}" \
|| true # dont let a failed push abort the script || true # don't let a failed push abort the script
} }
check_http() { # url check_http() { # url
@ -30,7 +30,7 @@ check_http() { # url
check_service() { systemctl is-active --quiet "$1" && echo "up 0" || echo "down 0"; } check_service() { systemctl is-active --quiet "$1" && echo "up 0" || echo "down 0"; }
check_docker() { docker inspect -f '{{.State.Running}}' "$1" &>/dev/null && echo "up 0" || echo "down 0"; } check_docker() { docker inspect -f '{{.State.Running}}' "$1" &>/dev/null && echo "up 0" || echo "down 0"; }
check_mount() { mountpoint -q "$1" && echo "up 0" || echo "down 0"; } check_mount() { mountpoint -q "$1" && echo "up 0" || echo "down 0"; }
check_native() { echo "up 0"; } # simply reports “alive” check_native() { echo "up 0"; } # simply reports "alive"
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Iterate over YAML entries (null-delimited to survive spaces) # Iterate over YAML entries (null-delimited to survive spaces)