6
7
# Connect Agent to Cloud
8
9
-You can securely connect a Netdata Agent, running on a distributed node, to securely connect to Netdata Cloud. A Space's
9
+You can securely connect a Netdata Agent, running on a distributed node, to Netdata Cloud. A Space's
10
administrator creates a **claiming token**, which is used to add an Agent to their Space via the [Agent-Cloud link
11
(ACLK)](/aclk/README.md).
12
14
Cloud](https://learn.netdata.cloud/docs/cloud/get-started) guide for a walkthrough of the process and simplified
15
instructions.
16
17
-Connecting Agents, also referrered as **nodes**, is a security feature in Netdata Cloud. Through the connection process, you demonstrate in a few ways
18
-that you have administrative access to that node and the configuration settings for the Netdata Agent. By logging into the node,
19
-you prove you have access, and by using the claiming script or the Netdata command line, you prove you have write access
20
-and administrative privileges.
17
+When connecting an agent (also referred to as a node) to Netdata Cloud, you must complete a verification process that proves you have some level of authorization to manage the node itself. This verification is a security feature that helps prevent unauthorized users from seeing the data on your node.
18
19
Only the administrators of a Space in Netdata Cloud can view the claiming token and accompanying script generated by
20
Netdata Cloud.
38
39
## How to connect a node
40
41
+There will be three main flows from where you might want to connect a node to Netdata Cloud.
42
+* when you are on an [empty War Room](#empty-war-room) and you want to connect your first node
43
+* when you are at the [Manage Space](#manage-space-or-war-room) area and you select **Connect Nodes** to connect a node, coming from Manage Space or Manage War Room
44
+* when you are the the [Nodes view page](learn.netdata.cloud/docs/cloud/visualize/nodes) and want to connect a node - this process falls into the [Manage Space](#manage-space-or-war-room) flow
45
+
46
+Please note that only the administrators of a Space in Netdata Cloud can view the claiming token and accompanying script, generated by Netdata Cloud, to trigger the connection process.
47
+
48
+### Empty War Room
49
+
50
+Either at your first sign in or following ones, when you enter Netdata Cloud and are at a War Room that doesn’t have any node added to it you will be able to:
51
+* connect a new node to Netdata Cloud and add it to the War Room you are in
52
+* add a previously connected node to the War Room you are in
53
+
54
+If your case is to connect a new node and add it to the War Room, you will need to tell us what environment the node is running on (Linux, Docker, macOS, Kubernetes) and then we will provide you with a script to initiate the connection process. You just will need to copy and paste it into your node's terminal. See one of the following sections depending on your case:
55
+* [Linux](#connect-an-agent-running-in-linux)
56
+* [Docker](#connect-an-agent-running-in-docker)
57
+* [macOS](#connect-an-agent-running-in-macos)
58
+* [Kubernetes](#connect-a-kubernetes-clusters-parent-netdata-pod)
59
+
60
+Repeat this process with every node you want to add to Netdata Cloud during onboarding. You can also add more nodes once you've
61
+finished onboarding.
62
+### Manage Space or War Room
63
+
64
To connect a node, select which War Rooms you want to add this node to with the dropdown, then copy and paste the script
45
-given by Cloud into your node's terminal. Hit **Enter**.
65
+given by Netdata Cloud into your node's terminal.
66
+
67
+When coming from [Nodes view page](learn.netdata.cloud/docs/cloud/visualize/nodes) the room parameter is already defined to current War Room.
68
+
69
+### Connect an agent running in Linux
70
+
71
+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/#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:
72
47
-```bash
48
-sudo netdata-claim.sh -token=TOKEN -rooms=ROOM1,ROOM2 -url=https://app.netdata.cloud
73
```
74
+bash <(curl -Ss https://my-netdata.io/kickstart.sh) --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
75
+```
76
+The script should return `Agent was successfully claimed.`. If the connecting to Netdata Cloud process returns errors, or if you don't see
77
+the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting).
78
51
-The script should return `Agent was successfully claimed.`. If the claiming script returns errors, or if you don't see
52
-the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting). If you prefer not to
53
-use root privileges via `sudo` to run the claiming script, see the next section.
79
+Please note that to run it you will either need to have root privileges or run it with the user that is running the agent, more details on the [Connect an agent without root privileges](#connect-an-agent-without-root-privileges) section.
80
55
-Repeat this process with every node you want to add to Cloud during onboarding. You can also add more nodes once you've
56
-finished onboarding.
81
+For more details on what are the extra parameters `claim-token`, `claim-rooms` and `claim-url` please refer to [Connect node to Netdata Cloud during installation](/packaging/installer/methods/kickstart#connect-node-to-netdata-cloud-during-installation).
82
83
### Connect an agent without root privileges
84
60
-If you don't want to run the claiming script with root privileges, you can discover which user is running the Agent,
61
-switch to that user, and run the claiming script.
85
+If you don't want to run the installation script to connect your nodes to Netdata Cloud with root privileges, you can discover which user is running the Agent,
86
+switch to that user, and run the script.
87
88
Use `grep` to search your `netdata.conf` file, which is typically located at `/etc/netdata/netdata.conf`, for the `run
89
as user` setting. For example:
90
+To connect a node, select which War Rooms you want to add this node to with the dropdown, then copy and paste the script
91
+given by Netdata Cloud into your node's terminal.
92
93
```bash
94
grep "run as user" /etc/netdata/netdata.conf
96
```
97
98
The default user is `netdata`. Yours may be different, so pay attention to the output from `grep`. Switch to that user
72
-and run the claiming script.
99
+and run the script.
100
101
```bash
75
-netdata-claim.sh -token=TOKEN -rooms=ROOM1,ROOM2 -url=https://app.netdata.cloud
102
+bash <(curl -Ss https://my-netdata.io/kickstart.sh) --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
103
```
77
-
78
-Hit **Enter**. The script should return `Agent was successfully claimed.`. If the claiming script returns errors, or if
79
-you don't see the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting).
80
-
81
-### Connect an Agent running in Docker
104
+### Connect an agent running in Docker
105
106
To connect an instance of the Netdata Agent running inside of a Docker container, either set claiming environment
107
variables in the container to have it automatically connected on startup or restart, or use `docker exec` to manually
125
Rooms. If a proxy is specified, it will be used for the connection process and for connecting to Netdata Cloud.
126
127
These variables can be specified using any mechanism supported by your container tooling for setting environment
105
-variables inside containers. For example, when creating a new Netdata continer using `docker run`, the following
106
-modified version of the command can be used to set the variables:
128
+variables inside containers. For example, when creating a new Netdata container using `docker run`, the following
129
108
-```bash
130
+When using the `docker run` command, if you have an agent container already running, it is important to know that there will be a short period of downtime. This is due to the process of recreating the new agent container.
131
+
132
+The command that Netdata Cloud will provide to you is:
133
+
134
+```bash
135
docker run -d --name=netdata \
136
-p 19999:19999 \
137
+ -v netdataconfig:/etc/netdata \
138
-v netdatalib:/var/lib/netdata \
139
-v netdatacache:/var/cache/netdata \
140
-v /etc/passwd:/host/etc/passwd:ro \
142
-v /proc:/host/proc:ro \
143
-v /sys:/host/sys:ro \
144
-v /etc/os-release:/host/etc/os-release:ro \
118
- -e NETDATA_CLAIM_TOKEN=TOKEN \
119
- -e NETDATA_CLAIM_URL="https://app.netdata.cloud" \
120
- -e NETDATA_CLAIM_ROOMS=ROOM1,ROOM2 \
145
--restart unless-stopped \
146
--cap-add SYS_PTRACE \
147
--security-opt apparmor=unconfined \
124
- netdata/netdata
148
+ -e NETDATA_CLAIM_TOKEN=TOKEN \
149
+ -e NETDATA_CLAIM_URL="https://app.netdata.cloud" \
150
+ -e NETDATA_CLAIM_ROOMS=ROOM1,ROOM2 \
151
+ -e NETDATA_CLAIM_PROXY=PROXY \
152
+ netdata/netdata
153
```
154
127
-Output that would be seen from the claiming script when using other methods will be present in the container logs.
155
+The output that would be seen from the connection process when using other methods will be present in the container logs.
156
157
Using the environment variables like this to handle the connection process is the preferred method of connecting Docker containers
158
as it works in the widest variety of situations and simplifies configuration management.
159
160
+#### Using Docker compose
161
+
162
+If you use `docker compose` you can copy the config provided by Netdata Cloud, which should be same as the one below:
163
+
164
+```bash
165
+version: '3'
166
+services:
167
+ netdata:
168
+ image: netdata/netdata
169
+ container_name: netdata
170
+ hostname: example.com # set to fqdn of host
171
+ ports:
172
+ - 19999:19999
173
+ restart: unless-stopped
174
+ cap_add:
175
+ - SYS_PTRACE
176
+ security_opt:
177
+ - apparmor:unconfined
178
+ volumes:
179
+ - netdataconfig:/etc/netdata
180
+ - netdatalib:/var/lib/netdata
181
+ - netdatacache:/var/cache/netdata
182
+ - /etc/passwd:/host/etc/passwd:ro
183
+ - /etc/group:/host/etc/group:ro
184
+ - /proc:/host/proc:ro
185
+ - /sys:/host/sys:ro
186
+ - /etc/os-release:/host/etc/os-release:ro
187
+ environment:
188
+ - NETDATA_CLAIM_TOKEN=TOKEN
189
+ - NETDATA_CLAIM_URL="https://app.netdata.cloud"
190
+ - NETDATA_CLAIM_ROOMS=ROOM1,ROOM2
191
+
192
+volumes:
193
+ netdataconfig:
194
+ netdatalib:
195
+ netdatacache:
196
+```
197
+
198
+Then run the following command in the same directory as the `docker-compose.yml` file to start the container.
199
+
200
+```bash
201
+docker-compose up -d
202
+```
203
+
204
#### Using docker exec
205
134
-Connect a _running Netdata Agent container_ by appending the script offered by Cloud to a `docker exec ...` command, replacing
206
+Connect a _running Netdata Agent container_, where you don't want to recreate the existing container, append the script offered by Netdata Cloud to a `docker exec ...` command, replacing
207
`netdata` with the name of your running container:
208
209
```bash
210
docker exec -it netdata netdata-claim.sh -token=TOKEN -rooms=ROOM1,ROOM2 -url=https://app.netdata.cloud
211
```
212
141
-The script should return `Agent was successfully claimed.`. If the claiming script returns errors, or if
213
+The script should return `Agent was successfully claimed.`. If the connection process returns errors, or if
214
you don't see the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting).
215
216
+### Connect an agent running in macOS
217
+
218
+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#install-netdata-with-kickstart) 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:
219
+
220
+```bash
221
+bash <(curl -Ss https://my-netdata.io/kickstart.sh) --install /usr/local/ --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud
222
+```
223
+The script should return `Agent was successfully claimed.`. If the connecting to Netdata Cloud process returns errors, or if you don't see
224
+the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting).
225
+
226
### Connect a Kubernetes cluster's parent Netdata pod
227
228
Read our [Kubernetes installation](/packaging/installer/methods/kubernetes.md#connect-a-kubernetes-clusters-parent-pod)
255
proxy = socks5h://proxy.example.com:1080 # With a URL
256
```
257
176
-You can now move on to connecting. When you connect with the `netdata-claim.sh` script, add the `-proxy=` parameter and
258
+You can now move on to connecting. When you connect with the [kickstart](/packaging/installer/#automatic-one-line-installation-script) script, add the `--claim-proxy=` parameter and
259
append the same proxy setting you added to `netdata.conf`.
260
261
```bash
180
-sudo netdata-claim.sh -token=MYTOKEN1234567 -rooms=room1,room2 -url=https://app.netdata.cloud -proxy=socks5h://203.0.113.0:1080
262
+bash <(curl -Ss https://my-netdata.io/kickstart.sh) --claim-token TOKEN --claim-rooms ROOM1,ROOM2 --claim-url https://app.netdata.cloud --claim-proxy socks5h://203.0.113.0:1080
263
```
264
183
-Hit **Enter**. The script should return `Agent was successfully claimed.`. If the claiming script returns errors, or if
265
+Hit **Enter**. The script should return `Agent was successfully claimed.`. If the connecting to Netdata Cloud process returns errors, or if
266
you don't see the node in your Space after 60 seconds, see the [troubleshooting information](#troubleshooting).
267
268
### Troubleshooting
282
283
Use these keys and the information below to troubleshoot the ACLK.
284
285
+#### kickstart: unsupported Netdata installation
286
+
287
+If you run the kickstart script and get the following error `Existing install appears to be handled manually or through the system package manager.` you most probably installed Netdata using an unsupported package.
288
+
289
+If you are using an unsupported package, such as a third-party `.deb`/`.rpm` package provided by your distribution,
290
+please remove that package and reinstall using our [recommended kickstart
291
+script](/docs/get-started.mdx#install-on-linux-with-one-line-installer-recommended).
292
+
293
+#### kickstart: Failed to write new machine GUID
294
+
295
+If you run the kickstart script but don't have privileges required for the actions done on the connecting to Netdata Cloud process you will get the following error:
296
+
297
+```bash
298
+Failed to write new machine GUID. Please make sure you have rights to write to /var/lib/netdata/registry/netdata.public.unique.id.
299
+```
300
+For a successful execution you will need to run the script with root privileges or run it with the user that is running the agent, more details on the [Connect an agent without root privileges](#connect-an-agent-without-root-privileges) section.
301
+
302
#### bash: netdata-claim.sh: command not found
303
304
If you run the claiming script and see a `command not found` error, you either installed Netdata in a non-standard
412
You will still be able to see this node in your War Rooms in an **unreachable** state.
413
414
If you want to reconnect this node into a different Space, you need to create a new identity by adding `-id=$(uuidgen)` to
316
-the claiming script parameters. Make sure that you have the `uuidgen-runtime` package installed, as it is used to run the command `uuidgen`. For example, using the default claiming script:
415
+the claiming script parameters (not yet supported on the kickstart script). Make sure that you have the `uuidgen-runtime` package installed, as it is used to run the command `uuidgen`. For example:
416
+
417
+**Claiming script**
418
419
```bash
420
sudo netdata-claim.sh -token=TOKEN -rooms=ROOM1,ROOM2 -url=https://app.netdata.cloud -id=$(uuidgen)
423
The agent _must be restarted_ after this change.
424
425
## Connecting reference
325
-
326
-In the sections below, you can find reference material for the claiming script, connecting via the Agent's command line
426
+In the sections below, you can find reference material for the kickstart script, claiming script, connecting via the Agent's command line
427
tool, and details about the files found in `cloud.d`.
428
429
### The `cloud.conf` file
436
| 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. |
437
| enabled | yes | The runtime option to disable the [Agent-Cloud link](/aclk/README.md) and prevent your Agent from connecting to Netdata Cloud. |
438
439
+### kickstart script
440
+
441
+The best way to install Netdata and connect your nodes to Netdata Cloud is with our automatic one-line installation script, [kickstart](/packaging/installer/#automatic-one-line-installation-script). This script will install the Netdata Agent, in case it isn't already installed, and connect your node to Netdata Cloud.
442
+
443
+This works with:
444
+* all Linux distributions, see [Netdata distribution support matrix](https://learn.netdata.cloud/docs/agent/packaging/distributions)
445
+* macOS
446
+
447
+For details on how to run this script please check [How to connect a node](#how-to-connect-a-node) and choose your environment.
448
+
449
+In case Netdata Agent is already installed and you run this script to connect a node to Netdata Cloud it will not upgrade your agent automatically. If you also want to upgrade the Agent installation you'll need to run the script again without the connection options.
450
+
451
+Our suggestion is to first run kickstart to upgrade your agent by running the command below and the run the [How to connect a node]
452
+(#how-to-connect-a-node).
453
+
454
+**Linux**
455
+
456
+```bash
457
+bash <(curl -Ss https://my-netdata.io/kickstart.sh)
458
+```
459
+
460
+**macOS**
461
+
462
+```bash
463
+bash <(curl -Ss https://my-netdata.io/kickstart.sh) --install /usr/local/
464
+```
465
### Claiming script
466
341
-A Space's administrator can connect an Agent by directly calling the `netdata-claim.sh` script either with root privileges
467
+A Space's administrator can also connect an Agent by directly calling the `netdata-claim.sh` script either with root privileges
468
using `sudo`, or as the user running the Agent (typically `netdata`), and passing the following arguments:
469
470
```sh
496
497
This reloads the Agent connection state from disk.
498
499
+Our recommendation is to trigger the connection process using the [kickstart](/packaging/installer/#automatic-one-line-installation-script) whenever possible.
500
+
501
### Netdata Agent command line
502
503
If a Netdata Agent is running, the Space's administrator can connect a node using the `netdata` service binary with
528
The user can also put the Cloud endpoint's full certificate chain in `cloud.d/cloud_fullchain.pem` so that the Agent
529
can trust the endpoint if necessary.
530
403
-[](<>)
531
+[](<>)
\ No newline at end of file