Uptime (Linux / macOS) bash
Posts /proc/uptime as days. Use with capture.value to nag for reboots after N days.
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
# uptime.sh — uptime in seconds + days.
URL='YOUR_URL/uptime'
SECS=$(cat /proc/uptime | awk '{print int($1)}')
DAYS=$(awk "BEGIN { printf \"%.2f\", $SECS / 86400 }")
curl -fsS -m 15 -H 'Content-Type: application/json' \
--data-raw "{\"hostname\": \"$(hostname)\", \"uptime_seconds\": $SECS, \"uptime_days\": $DAYS}" \
"$URL"
Recommended pairing
Add a capture.value check to this capture object.
json_path = uptime_days, op = >, threshold = 30.
What is the filename?
uptime.sh — this is the suggested name for the downloaded file. Rename freely if you prefer.
site1.erralert.com