Skip to content

Instantly share code, notes, and snippets.

@Br3nda
Created November 11, 2025 21:32
Show Gist options
  • Select an option

  • Save Br3nda/1c954ee29c35ab6cbdfabbeecb658a58 to your computer and use it in GitHub Desktop.

Select an option

Save Br3nda/1c954ee29c35ab6cbdfabbeecb658a58 to your computer and use it in GitHub Desktop.
tell slack when load is high
#!/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
@Br3nda
Copy link
Author

Br3nda commented Nov 11, 2025

hacky script i made in an outage, whacked into cron, to yell at us if load climbs again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment