@cryptotaxi247 / netdata-1 / commits / dca1f34ae

aclk: move "proxy" from "netdata.conf" to "cloud.conf" (#17836)

Ilya Mashchenko committed Jun 7, 2024 at 13:32 UTC dca1f34ae8f2cfa0c45bc1d4e9f6362b9245dd73
3 files changed +18 -17
src/aclk/aclk_proxy.c
+6 -1
@@ -113,7 +113,12 @@ static inline int check_http_enviroment(const char **proxy)
113
114 const char *aclk_lws_wss_get_proxy_setting(ACLK_PROXY_TYPE *type)
115 {
116 - const char *proxy = config_get(CONFIG_SECTION_CLOUD, ACLK_PROXY_CONFIG_VAR, ACLK_PROXY_ENV);
116 + const char *proxy = appconfig_get(&cloud_config, CONFIG_SECTION_GLOBAL, ACLK_PROXY_CONFIG_VAR, ACLK_PROXY_ENV);
117 +
118 + // backward compatibility: "proxy" was in "netdata.conf"
119 + if (config_exists(CONFIG_SECTION_CLOUD, ACLK_PROXY_CONFIG_VAR))
120 + proxy = config_get(CONFIG_SECTION_CLOUD, ACLK_PROXY_CONFIG_VAR, ACLK_PROXY_ENV);
121 +
122 *type = PROXY_DISABLED;
123
124 if (strcmp(proxy, "none") == 0)
src/claim/README.md
+8 -7
@@ -60,7 +60,7 @@ Claiming script options:
60 | Option | Description | Required | Default value |
61 |--------|--------------------------------------------------------------------|:--------:|:------------------------------------------------------|
62 | token | The claiming token for your Netdata Cloud Space. | yes | |
63 -| rooms | A comma-separated list of Rooms to add the Agent to. | no | The Agent will be added to the "All nodes" Room only. |
63 +| rooms | A comma-separated list of Rooms to add the Agent to. | no | The Agent will be added to the "All nodes" Room only. |
64 | id | The unique identifier of the Agent. | no | The Agent's MACHINE_GUID. |
65 | proxy | The URL of a proxy server to use for the connection, if necessary. | no | |
66
@@ -325,13 +325,14 @@ Agent's command line tool, and details about the files found in `cloud.d`.
325
326 ### The `cloud.conf` file
327
328 -This section defines how and whether your Agent connects to Netdata Cloud
329 -using the [ACLK](/src/aclk/README.md).
328 +This section defines how and whether your Agent connects to Netdata Cloud using
329 +the [Agent-Cloud link](/src/aclk/README.md)(ACLK).
330
331 -| setting | default | info |
332 -|:---------------|:----------------------------|:---------------------------------------------------------------------------------------------------------------------------------------|
333 -| cloud base url | <https://app.netdata.cloud> | The URL for the Netdata Cloud web application. You should not change this. If you want to disable Cloud, change the `enabled` setting. |
334 -| enabled | yes | The runtime option to disable the [Agent-Cloud link](/src/aclk/README.md) and prevent your Agent from connecting to Netdata Cloud. |
331 +| setting | default | info |
332 +|:---------------|:----------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------|
333 +| enabled | yes | Controls whether the ACLK is active. Set to no to prevent the Agent from connecting to Netdata Cloud. |
334 +| cloud base url | <https://app.netdata.cloud> | The URL for the Netdata Cloud web application. Typically, this should not be changed. |
335 +| proxy | env | Specifies the proxy setting for the ACLK. Options: none (no proxy), env (use environment's proxy), or a URL (e.g., `http://proxy.example.com:1080`). |
336
337 ### Connection directory
338
src/claim/netdata-claim.sh.in
+4 -9
@@ -422,29 +422,24 @@ HERE_DOC
422 exit $EXIT_CODE
423 fi
424
425 - if [ -z "${PROXY}" ]; then
426 - PROXYMSG=""
427 - else
428 - PROXYMSG="You have attempted to claim this node through a proxy - please update your the proxy setting in your netdata.conf to ${PROXY}. "
429 - fi
425 # Update cloud.conf in the agent memory
426 @sbindir_POST@/netdatacli write-config 'cloud|global|enabled|yes' && \
427 @sbindir_POST@/netdatacli write-config "cloud|global|cloud base url|$URL_BASE" && \
428 @sbindir_POST@/netdatacli reload-claiming-state && \
429 if [ "${HTTP_STATUS_CODE}" = "204" ] ; then
435 - echo >&2 "${PROXYMSG}Node was successfully claimed."
430 + echo >&2 "Node was successfully claimed."
431 else
432 echo >&2 "The agent cloud base url is set to the url provided."
433 echo >&2 "The cloud may have different credentials already registered for this agent ID and it cannot be reclaimed under different credentials for security reasons. If you are unable to connect use -id=\$(uuidgen) to overwrite this agent ID with a fresh value if the original credentials cannot be restored."
439 - echo >&2 "${PROXYMSG}Failed to claim node with the following error message:\"${ERROR_MESSAGES[$EXIT_CODE]}\""
434 + echo >&2 "Failed to claim node with the following error message:\"${ERROR_MESSAGES[$EXIT_CODE]}\""
435 fi && exit $EXIT_CODE
436
437 if [ "${ERROR_KEY}" = "ErrAlreadyClaimed" ] ; then
438 echo >&2 "The cloud may have different credentials already registered for this agent ID and it cannot be reclaimed under different credentials for security reasons. If you are unable to connect use -id=\$(uuidgen) to overwrite this agent ID with a fresh value if the original credentials cannot be restored."
444 - echo >&2 "${PROXYMSG}Failed to claim node with the following error message:\"${ERROR_MESSAGES[$EXIT_CODE]}\""
439 + echo >&2 "Failed to claim node with the following error message:\"${ERROR_MESSAGES[$EXIT_CODE]}\""
440 exit $EXIT_CODE
441 fi
447 - echo >&2 "${PROXYMSG}The claim was successful but the agent could not be notified ($?)- it requires a restart to connect to the cloud."
442 + echo >&2 "The claim was successful but the agent could not be notified ($?)- it requires a restart to connect to the cloud."
443 [ "$NETDATA_RUNNING" -eq 0 ] && exit 0 || exit 5
444 fi
445