alarm-notify.sh should respect the cloud base url setting (#6383)

Fixes #5791

This patch exports through netdata daemon as an environment variable the NETDATA_REGISTRY_CLOUD_BASE_URL in order for the alarm-notify.sh.in to be able to use it. Therefore we can skip the hardcoded reference to cloud URL inside the script.
This commit is contained in:
ladakis 2019-07-04 16:27:22 +03:00 committed by Chris Akritidis
parent 9d41bd6ff2
commit 1f51a65328
2 changed files with 3 additions and 1 deletions

View File

@ -189,6 +189,7 @@ fi
[ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@"
[ -z "${NETDATA_CACHE_DIR}" ] && NETDATA_CACHE_DIR="@cachedir_POST@"
[ -z "${NETDATA_REGISTRY_URL}" ] && NETDATA_REGISTRY_URL="https://registry.my-netdata.io"
[ -z "${NETDATA_REGISTRY_CLOUD_BASE_URL}" ] && NETDATA_REGISTRY_CLOUD_BASE_URL="https://netdata.cloud"
# -----------------------------------------------------------------------------
# parse command line parameters
@ -1798,7 +1799,7 @@ fi
if [ ${GOTOCLOUD} -eq 0 ]; then
goto_url="${NETDATA_REGISTRY_URL}/goto-host-from-alarm.html?${redirect_params}"
else
goto_url="https://netdata.cloud/alarms/redirect?agentID=${NETDATA_REGISTRY_UNIQUE_ID}&${redirect_params}"
goto_url="${NETDATA_REGISTRY_CLOUD_BASE_URL}/alarms/redirect?agentID=${NETDATA_REGISTRY_UNIQUE_ID}&${redirect_params}"
fi
# the severity of the alarm

View File

@ -43,6 +43,7 @@ int registry_init(void) {
// netdata.cloud configuration, if cloud_base_url == "", cloud functionality is disabled.
registry.cloud_base_url = config_get(CONFIG_SECTION_CLOUD, "cloud base url", "https://netdata.cloud");
setenv("NETDATA_REGISTRY_CLOUD_BASE_URL", registry.cloud_base_url, 1);
setenv("NETDATA_REGISTRY_HOSTNAME", registry.hostname, 1);
setenv("NETDATA_REGISTRY_URL", registry.registry_to_announce, 1);