Created
March 7, 2018 03:41
-
-
Save koni/b373eb13f1848ab5d7bbcd303242d3c7 to your computer and use it in GitHub Desktop.
DiskUsageを閾値を超えたらSlack Webhookでチャンネルに通知.sh
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
#!/bin/sh | |
DVAL=`/bin/df / | /usr/bin/tail -1 | /bin/sed 's/^.* \([0-9]*\)%.*$/\1/'` | |
if [ $DVAL -gt 80 ]; then | |
curl -s -S -X POST --data-urlencode "payload={\"channel\": \"alert\", \"username\": \"web.social-dog.net\", \"icon_emoji\": \":warning:\", \"text\": \"Disk Usage $DVAL%\" }" [webhook URL] >/dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment