Skip to content

Instantly share code, notes, and snippets.

@stevenharradine
Last active April 24, 2017 19:57
Show Gist options
  • Save stevenharradine/47c3ef8804a958c3bebede58474b7755 to your computer and use it in GitHub Desktop.
Save stevenharradine/47c3ef8804a958c3bebede58474b7755 to your computer and use it in GitHub Desktop.
send disk usage to slack
slacktoken="TOKEN/TOKEN/TOKEN"
slackchannel="#welcome"
hostname=`cat /etc/hostname`
diskspace=`/bin/df -h | /usr/bin/xargs -L 1 /bin/echo "\n"`
curl -X POST --data-urlencode 'payload={"channel": "$slackchannel", "username": "webhookbot", "text": "'"$hostname""\n""$diskspace"'", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/$slacktoken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment