Last active
September 26, 2018 08:06
-
-
Save cuu508/8c215049f287825748b1c1a1e236bb2c to your computer and use it in GitHub Desktop.
Report load average to Healthchecks.io. If it's above the configured threshold, use the "/fail" endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this from cron every minute: | |
# * * * * * checkloadavg.sh | |
CODE=ca75b1df-4f4e-4711-8dc0-f21eeb4b0dac | |
AVG=$(cat /proc/loadavg | cut -d " " -f 1) | |
THRESHOLD=0.5 | |
if (( $(echo "$AVG > $THRESHOLD" | bc -l) )); then | |
curl --retry 3 -d "Load average: $AVG" -X POST https://hc-ping.com/$CODE/fail | |
else | |
curl --retry 3 -d "Load average: $AVG" -X POST https://hc-ping.com/$CODE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment