@cryptotaxi247 / netdata-1 / commits / 58ff07c3b

alarm icons are always served from the global public registry; fixes #941

Costa Tsaousis (ktsaou) committed Sep 14, 2016 at 00:40 UTC 58ff07c3b1d5a9664b073600e96c8fa197eb2691
1 file changed +10 -5
plugins.d/alarm-notify.sh
+10 -5
@@ -58,6 +58,11 @@ fi
58 # -----------------------------------------------------------------------------
59 # load configuration
60
61 +# this is defined here so that private registries
62 +# can setup their own
63 +# images_base_url="${NETDATA_REGISTRY_URL}"
64 +images_base_url="https://registry.my-netdata.io"
65 +
66 # needed commands
67 # if empty they will be searched in the system path
68 curl=
@@ -343,7 +348,7 @@ send_slack() {
348 for channel in ${channels}
349 do
350 httpcode=$(${curl} --write-out %{http_code} --silent --output /dev/null -X POST --data-urlencode \
346 - "payload={\"channel\": \"#${channel}\", \"username\": \"${username}\", \"text\": \"${host} ${status_message} - ${author} ${raised_for} - click <${goto_url}|here> to view the netdata dashboard.\", \"icon_url\": \"${image}\", \"attachments\": [{\"fallback\": \"${alarm} - ${info}\", \"color\": \"${color}\", \"title\": \"${alarm}\", \"title_link\": \"${goto_url}\", \"text\": \"${info}\", \"footer\": \"netdata\", \"footer_icon\": \"${NETDATA_REGISTRY_URL}/images/seo-performance-128.png\", \"ts\": ${when}}]}" \
351 + "payload={\"channel\": \"#${channel}\", \"username\": \"${username}\", \"text\": \"${host} ${status_message} - ${author} ${raised_for} - click <${goto_url}|here> to view the netdata dashboard.\", \"icon_url\": \"${image}\", \"attachments\": [{\"fallback\": \"${alarm} - ${info}\", \"color\": \"${color}\", \"title\": \"${alarm}\", \"title_link\": \"${goto_url}\", \"text\": \"${info}\", \"footer\": \"netdata\", \"footer_icon\": \"${images_base_url}/images/seo-performance-128.png\", \"ts\": ${when}}]}" \
352 "${webhook}")
353
354 if [ "${httpcode}" == "200" ]
@@ -390,24 +395,24 @@ color="grey"
395 alarm="${name//_/ } = ${value} ${units}"
396
397 # the image of the alarm
393 -image="${NETDATA_REGISTRY_URL}/images/seo-performance-128.png"
398 +image="${images_base_url}/images/seo-performance-128.png"
399
400 # prepare the title based on status
401 case "${status}" in
402 CRITICAL)
398 - image="${NETDATA_REGISTRY_URL}/images/alert-128-red.png"
403 + image="${images_base_url}/images/alert-128-red.png"
404 status_message="is critical"
405 color="#ca414b"
406 ;;
407
408 WARNING)
404 - image="${NETDATA_REGISTRY_URL}/images/alert-128-orange.png"
409 + image="${images_base_url}/images/alert-128-orange.png"
410 status_message="needs attention"
411 color="#caca4b"
412 ;;
413
414 CLEAR)
410 - image="${NETDATA_REGISTRY_URL}/images/check-mark-2-128-green.png"
415 + image="${images_base_url}/images/check-mark-2-128-green.png"
416 status_message="recovered"
417 color="#77ca6d"
418