@cryptotaxi247 / netdata-1 / commits / 208bf033a

Add emoji for telegram notifications

- Warning: ⚠️ - Critical: 🔴 - Clear: ✅ - Other: ⚪️

Ali Borhani committed Apr 8, 2017 at 15:58 UTC 208bf033af84ec16466a510e9ce71d6b5716b281
1 file changed +9 -2
plugins.d/alarm-notify.sh
+9 -2
@@ -939,9 +939,16 @@ send_messagebird() {
939 # telegram sender
940
941 send_telegram() {
942 - local bottoken="${1}" chatids="${2}" message="${3}" httpcode sent=0 chatid disableNotification=""
942 + local bottoken="${1}" chatids="${2}" message="${3}" httpcode sent=0 chatid emoji disableNotification=""
943
944 if [ "${status}" = "CLEAR" ]; then disableNotification="--data-urlencode disable_notification=true"; fi
945 +
946 + case "${status}" in
947 + WARNING) emoji="⚠️" ;;
948 + CRITICAL) emoji="🔴" ;;
949 + CLEAR) emoji="✅" ;;
950 + *) emoji="⚪️" ;;
951 + esac
952
953 if [ "${SEND_TELEGRAM}" = "YES" -a ! -z "${bottoken}" -a ! -z "${chatids}" -a ! -z "${message}" ];
954 then
@@ -951,7 +958,7 @@ send_telegram() {
958 httpcode=$(${curl} --write-out %{http_code} --silent --output /dev/null ${disableNotification} \
959 --data-urlencode "parse_mode=HTML" \
960 --data-urlencode "disable_web_page_preview=true" \
954 - --data-urlencode "text=${message}" \
961 + --data-urlencode "text=${emoji} ${message}" \
962 "https://api.telegram.org/bot${bottoken}/sendMessage?chat_id=${chatid}")
963
964 if [ "${httpcode}" == "200" ]