hipchat: detect html messages
Manuel Frei committed
Feb 22, 2017 at 22:50 UTC
ef63fa11f286b5bf8ba040dd50290ff85d1b20ad
1 file changed
+6
plugins.d/alarm-notify.sh
+6
@@ -865,6 +865,12 @@ send_hipchat() {
865
# Defaults to 'html'.
866
msg_format="text"
867
868
+ # Detect html messages
869
+ if echo "${message}" | tr -d '\n' | grep -q "<[a-z]\+>.*</[a-z]\+>\|<[a-z]\+/>"
870
+ then
871
+ msg_format="html"
872
+ fi
873
+
874
# Background color for message. Valid values: yellow, green, red, purple, gray, random. Defaults to 'yellow'.
875
case "${status}" in
876
WARNING) color="yellow" ;;