Last active
March 26, 2016 15:53
-
-
Save jarosite/5c881745d2b5265c2d9a to your computer and use it in GitHub Desktop.
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/sh | |
set -e | |
set -x | |
#{ | |
#date | |
export zabbixemailto=$1 | |
export zabbixsubject=$2 | |
export zabbixbody=$3 | |
slack_web_hook_url=https://hooks.slack.com/services/#####/#####/########## | |
if [[ "$zabbixsubject" =~ ^PROBLEM.* ]]; then | |
emoji=':thinking_face:' | |
color=danger | |
else | |
emoji=':smile:' | |
color=good | |
fi | |
curl -X POST --data-urlencode "payload={\"channel\": \"$zabbixemailto\", \"username\": \"zabbix_spammer\", \"icon_emoji\": \"$emoji\", \"attachments\":[ { \"fallback\":\"$zabbixsubject\", \"pretext\":\"$zabbixsubject\", \"text\": \"$zabbixbody\" , \"color\":\"$color\"} ]}" $slack_web_hook_url | |
#} 2>&1 | tee /var/log/zabbix_sendslack.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment