Skip to content

Instantly share code, notes, and snippets.

@higebu
Created May 27, 2015 14:09
Show Gist options
  • Save higebu/224b8761d17ba2aa4979 to your computer and use it in GitHub Desktop.
Save higebu/224b8761d17ba2aa4979 to your computer and use it in GitHub Desktop.
Zabbix alertscript for Let's chat
#!/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