@cryptotaxi247 / netdata-1 / commits / 1f51a6532

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.

ladakis committed Jul 4, 2019 at 16:27 UTC 1f51a653289745f11b0fe746c5af04fca2748994
2 files changed +3 -1
health/notifications/alarm-notify.sh.in
+2 -1
@@ -189,6 +189,7 @@ fi
189 [ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@"
190 [ -z "${NETDATA_CACHE_DIR}" ] && NETDATA_CACHE_DIR="@cachedir_POST@"
191 [ -z "${NETDATA_REGISTRY_URL}" ] && NETDATA_REGISTRY_URL="https://registry.my-netdata.io"
192 +[ -z "${NETDATA_REGISTRY_CLOUD_BASE_URL}" ] && NETDATA_REGISTRY_CLOUD_BASE_URL="https://netdata.cloud"
193
194 # -----------------------------------------------------------------------------
195 # parse command line parameters
@@ -1798,7 +1799,7 @@ fi
1799 if [ ${GOTOCLOUD} -eq 0 ]; then
1800 goto_url="${NETDATA_REGISTRY_URL}/goto-host-from-alarm.html?${redirect_params}"
1801 else
1801 - goto_url="https://netdata.cloud/alarms/redirect?agentID=${NETDATA_REGISTRY_UNIQUE_ID}&${redirect_params}"
1802 + goto_url="${NETDATA_REGISTRY_CLOUD_BASE_URL}/alarms/redirect?agentID=${NETDATA_REGISTRY_UNIQUE_ID}&${redirect_params}"
1803 fi
1804
1805 # the severity of the alarm
registry/registry_init.c
+1
@@ -43,6 +43,7 @@ int registry_init(void) {
43 // netdata.cloud configuration, if cloud_base_url == "", cloud functionality is disabled.
44 registry.cloud_base_url = config_get(CONFIG_SECTION_CLOUD, "cloud base url", "https://netdata.cloud");
45
46 + setenv("NETDATA_REGISTRY_CLOUD_BASE_URL", registry.cloud_base_url, 1);
47 setenv("NETDATA_REGISTRY_HOSTNAME", registry.hostname, 1);
48 setenv("NETDATA_REGISTRY_URL", registry.registry_to_announce, 1);
49