diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-30 18:47:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-30 18:47:00 +0000 |
commit | 03bf87dcb06f7021bfb2df2fa8691593c6148aff (patch) | |
tree | e16b06711a2ed77cafb4b7754be0220c3d14a9d7 /claim | |
parent | Adding upstream version 1.36.1. (diff) | |
download | netdata-03bf87dcb06f7021bfb2df2fa8691593c6148aff.tar.xz netdata-03bf87dcb06f7021bfb2df2fa8691593c6148aff.zip |
Adding upstream version 1.37.0.upstream/1.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | claim/README.md | 18 | ||||
-rw-r--r-- | claim/claim.c | 15 | ||||
-rwxr-xr-x | claim/netdata-claim.sh.in | 2 |
3 files changed, 18 insertions, 17 deletions
diff --git a/claim/README.md b/claim/README.md index 9202645e..3731d200 100644 --- a/claim/README.md +++ b/claim/README.md @@ -73,7 +73,7 @@ When coming from [Nodes view page](https://learn.netdata.cloud/docs/cloud/visua If you want to connect a node that is running on a Linux environment, the script that will be provided to you by Netdata Cloud is the [kickstart](/packaging/installer/README.md#automatic-one-line-installation-script) which will install the Netdata Agent on your node, if it isn't already installed, and connect the node to Netdata Cloud. It should be similar to: ``` -wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://api.netdata.cloud ``` The script should return `Agent was successfully claimed.`. If the connecting to Netdata Cloud process returns errors, or if you don't see the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting). @@ -101,7 +101,7 @@ The default user is `netdata`. Yours may be different, so pay attention to the o and run the script. ```bash -wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://api.netdata.cloud ``` ### Connect an agent running in Docker @@ -212,7 +212,7 @@ docker run -d --name=netdata \ --cap-add SYS_PTRACE \ --security-opt apparmor=unconfined \ -e NETDATA_CLAIM_TOKEN=TOKEN \ - -e NETDATA_CLAIM_URL="https://app.netdata.cloud" \ + -e NETDATA_CLAIM_URL="https://api.netdata.cloud" \ -e NETDATA_CLAIM_ROOMS=ROOM1,ROOM2 \ -e NETDATA_CLAIM_PROXY=PROXY \ netdata/netdata @@ -256,7 +256,7 @@ services: - /etc/os-release:/host/etc/os-release:ro environment: - NETDATA_CLAIM_TOKEN=TOKEN - - NETDATA_CLAIM_URL="https://app.netdata.cloud" + - NETDATA_CLAIM_URL="https://api.netdata.cloud" - NETDATA_CLAIM_ROOMS=ROOM1,ROOM2 volumes: @@ -276,7 +276,7 @@ Connect a _running Netdata Agent container_, where you don't want to recreate th `netdata` with the name of your running container: ```bash -docker exec -it netdata netdata-claim.sh -token=TOKEN -rooms=ROOM1,ROOM2 -url=https://app.netdata.cloud +docker exec -it netdata netdata-claim.sh -token=TOKEN -rooms=ROOM1,ROOM2 -url=https://api.netdata.cloud ``` The values for `ROOM1,ROOM2` can be found by by going to Netdata Cloud, clicking the **Nodes** tab, clicking **Connect Nodes**, selecting **Docker**, and copying the `rooms=` value in the command provided. @@ -288,7 +288,7 @@ you don't see the node in your Space after 60 seconds, see the [troubleshooting To connect a node that is running on a macOS environment the script that will be provided to you by Netdata Cloud is the [kickstart](/packaging/installer/methods/macos.md#install-netdata-with-our-automatic-one-line-installation-script) which will install the Netdata Agent on your node, if it isn't already installed, and connect the node to Netdata Cloud. It should be similar to: ```bash -curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud +curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh --install /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://api.netdata.cloud ``` The script should return `Agent was successfully claimed.`. If the connecting to Netdata Cloud process returns errors, or if you don't see the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting). @@ -328,7 +328,7 @@ You can now move on to connecting. When you connect with the [kickstart](/packag append the same proxy setting you added to `netdata.conf`. ```bash -wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud --claim-proxy http://[user:pass@]host:ip +wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://api.netdata.cloud --claim-proxy http://[user:pass@]host:ip ``` Hit **Enter**. The script should return `Agent was successfully claimed.`. If the connecting to Netdata Cloud process returns errors, or if @@ -511,7 +511,7 @@ using the [ACLK](/aclk/README.md). | setting | default | info | |:-------------- |:------------------------- |:-------------------------------------------------------------------------------------------------------------------------------------- | -| 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. | +| cloud base url | https://api.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. | | enabled | yes | The runtime option to disable the [Agent-Cloud link](/aclk/README.md) and prevent your Agent from connecting to Netdata Cloud. | ### kickstart script @@ -551,7 +551,7 @@ using `sudo`, or as the user running the Agent (typically `netdata`), and passin -rooms=ROOM1,ROOM2,... where ROOMX is the War Room this node should be added to. This list is optional. -url=URL_BASE - where URL_BASE is the Netdata Cloud endpoint base URL. By default, this is https://app.netdata.cloud. + where URL_BASE is the Netdata Cloud endpoint base URL. By default, this is https://api.netdata.cloud. -id=AGENT_ID where AGENT_ID is the unique identifier of the Agent. This is the Agent's MACHINE_GUID by default. -hostname=HOSTNAME diff --git a/claim/claim.c b/claim/claim.c index 59c21aa3..d997fc84 100644 --- a/claim/claim.c +++ b/claim/claim.c @@ -2,7 +2,8 @@ #include "claim.h" #include "registry/registry_internals.h" -#include "aclk/aclk_api.h" +#include "aclk/aclk.h" +#include "aclk/aclk_proxy.h" char *claiming_pending_arguments = NULL; @@ -57,7 +58,7 @@ void claim_agent(char *claiming_arguments) int exit_code; pid_t command_pid; char command_buffer[CLAIMING_COMMAND_LENGTH + 1]; - FILE *fp; + FILE *fp_child_output, *fp_child_input; // This is guaranteed to be set early in main via post_conf_load() char *cloud_base_url = appconfig_get(&cloud_config, CONFIG_SECTION_GLOBAL, "cloud base url", NULL); @@ -83,14 +84,14 @@ void claim_agent(char *claiming_arguments) claiming_arguments); info("Executing agent claiming command 'netdata-claim.sh'"); - fp = mypopen(command_buffer, &command_pid); - if(!fp) { + fp_child_output = netdata_popen(command_buffer, &command_pid, &fp_child_input); + if(!fp_child_output) { error("Cannot popen(\"%s\").", command_buffer); return; } info("Waiting for claiming command to finish."); - while (fgets(command_buffer, CLAIMING_COMMAND_LENGTH, fp) != NULL) {;} - exit_code = mypclose(fp, command_pid); + while (fgets(command_buffer, CLAIMING_COMMAND_LENGTH, fp_child_output) != NULL) {;} + exit_code = netdata_pclose(fp_child_input, fp_child_output, command_pid); info("Agent claiming command returned with code %d", exit_code); if (0 == exit_code) { load_claiming_state(); @@ -169,7 +170,7 @@ void load_claiming_state(void) } invalidate_node_instances(&localhost->host_uuid, claimed_id ? &uuid : NULL); - store_claim_id(&localhost->host_uuid, claimed_id ? &uuid : NULL); + metaqueue_store_claim_id(&localhost->host_uuid, claimed_id ? &uuid : NULL); rrdhost_aclk_state_unlock(localhost); if (!claimed_id) { diff --git a/claim/netdata-claim.sh.in b/claim/netdata-claim.sh.in index 73f01662..f87fbc27 100755 --- a/claim/netdata-claim.sh.in +++ b/claim/netdata-claim.sh.in @@ -136,7 +136,7 @@ MACHINE_GUID_FILE="@registrydir_POST@/netdata.public.unique.id" CLAIMING_DIR="${NETDATA_VARLIB_DIR}/cloud.d" TOKEN="unknown" URL_BASE=$(get_config_value cloud global "cloud base url") -[ -z "$URL_BASE" ] && URL_BASE="https://app.netdata.cloud" # Cover post-install with --dont-start +[ -z "$URL_BASE" ] && URL_BASE="https://api.netdata.cloud" # Cover post-install with --dont-start ID="unknown" ROOMS="" [ -z "$HOSTNAME" ] && HOSTNAME=$(hostname) |