diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-06-17 16:09:29 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-06-17 16:09:29 +0300 |
commit | 38722a8ade2885e5a1dc37db888e925b9e0f3cf8 (patch) | |
tree | 49871e4ed369a2813b26762f8166a4f7ab491e4b | |
parent | 26c801d00ceeb0562b2bf81c1eed483652d307cc (diff) |
limit discord usernames to 32 characters; fixes #2344
-rwxr-xr-x | plugins.d/alarm-notify.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins.d/alarm-notify.sh b/plugins.d/alarm-notify.sh index 2932aac108..4f619091f1 100755 --- a/plugins.d/alarm-notify.sh +++ b/plugins.d/alarm-notify.sh @@ -1074,7 +1074,7 @@ EOF # discord sender send_discord() { - local webhook="${1}/slack" channels="${2}" httpcode sent=0 channel color payload + local webhook="${1}/slack" channels="${2}" httpcode sent=0 channel color payload username [ "${SEND_DISCORD}" != "YES" ] && return 1 @@ -1087,10 +1087,13 @@ send_discord() { for channel in ${channels} do + username="netdata on ${host}" + [ ${#username} -gt 32 ] && username="${username:0:29}..." + payload="$(cat <<EOF { "channel": "#${channel}", - "username": "netdata on ${host}", + "username": "${username}", "text": "${host} ${status_message}, \`${chart}\` (_${family}_), *${alarm}*", "icon_url": "${images_base_url}/images/seo-performance-128.png", "attachments": [ |