Created
May 27, 2015 14:09
-
-
Save higebu/224b8761d17ba2aa4979 to your computer and use it in GitHub Desktop.
Zabbix alertscript for Let's chat
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 | |
URL=http://yourdomain/messages | |
TOKEN='token' | |
TO=$1 | |
SUBJECT=$2 | |
MESSAGE=$(echo "$3"|perl -p -e 's/\n/\\n/g') | |
TEXT="${SUBJECT}:\\n${MESSAGE}" | |
PAYLOAD="{\"text\":\"${TEXT}\", \"room\":\"${TO}\"}" | |
curl -v -H "Accept: application/json" -H "Content-Type: application/json" \ | |
--user $TOKEN:pass -XPOST $URL -d "${PAYLOAD}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment