Created
November 11, 2025 21:32
-
-
Save Br3nda/1c954ee29c35ab6cbdfabbeecb658a58 to your computer and use it in GitHub Desktop.
tell slack when load is high
This file contains hidden or 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
| #!/bin/bash | |
| set -euv | |
| function tellSlack() { | |
| echo "TELL-SLACK:" "$@" | |
| cat <<EOF | curl --silent -X POST --data-binary @- "${SLACK_WEBHOOK}" | |
| payload={"type": "mrkdwn", "text":"\`$@\`"} | |
| EOF | |
| } | |
| load=$(uptime | awk '{print $10}' | cut -d "," -f 1) | |
| fullload=$(uptime | awk '{print $10 $11 $12}') | |
| if (( $(echo "$load > 4.0" | bc -l) )); then | |
| tellSlack "*HIGH LOAD* $load on $(hostname) - ${fullload}" | |
| touch .high-load | |
| elif test -f .high-load; then | |
| rm .high-load | |
| tellSlack "load ok $load on $(hostname)" | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hacky script i made in an outage, whacked into cron, to yell at us if load climbs again