master
md 325 lines 14.2 KB
Rendered Raw
1 # Connect Agent to Cloud
2
3 This section guides you through installing and securely connecting a new Agent to Netdata Cloud via the encrypted Agent-Cloud Link ([ACLK](/src/aclk/README.md)). Connecting your Agent to your Space unlocks centralized monitoring, easier collaboration, and more.
4
5 ## Quick Start - New Installation
6
7 **For new installations**, Netdata Cloud generates a command that you can execute on your Node to install and connect the Agent to your Space.
8
9 You can find this command in three places in the UI:
10
11 - **Space/Room settings**: Click the cogwheel (the bottom-left corner or next to the Room name at the top) and select "Nodes." Click the "+" button to add a new node.
12 - [**Nodes tab**](/docs/dashboards-and-charts/nodes-tab.md): Click on the "Add nodes" button.
13 - **Integrations page**: From the "Deploy" groups of integrations, select the OS or container environment your node runs on, and follow the instructions.
14
15 ## Connect Existing Agent
16
17 **For Agents already installed**, you can connect them to your Space using one of three methods:
18
19 ### Method 1: Via UI (Recommended)
20
21 **Best for:** Most users, easiest setup
22
23 1. Open your Agent's local dashboard (normally under `IP:19999`)
24 2. Sign in to your Netdata Cloud account
25 3. Click the "Connect" button
26 4. Follow the on-screen instructions to connect your Agent
27
28 ### Method 2: Via Configuration File
29
30 **Best for:** Automated deployments, multiple Agents
31
32 Create `/INSTALL_PREFIX/etc/netdata/claim.conf`:
33
34 ```bash
35 [global]
36 url = https://app.netdata.cloud
37 token = NETDATA_CLOUD_SPACE_TOKEN
38 rooms = ROOM_KEY1,ROOM_KEY2,ROOM_KEY3
39 proxy = http://username:password@myproxy:8080
40 insecure = no
41 ```
42
43 :::info
44
45 **File Permissions and Ownership:**
46
47 The `claim.conf` file contains sensitive claiming tokens and must be properly secured:
48
49 - **Required permissions (service installs):** `0640` (owner read/write, group read, no world access)
50 - **Required ownership (service installs):** `root:netdata` (owner root, group netdata)
51
52 The Netdata Cloud-generated claiming command automatically sets these permissions when creating or updating `claim.conf`. If you create the file manually, ensure it follows these same security standards to prevent unauthorized access to your claiming tokens.
53
54 :::
55
56 :::note
57
58 On macOS with Homebrew installs, the `netdata` group does not exist. Set ownership to your own user and the `staff` group instead:
59
60 ```bash
61 chown $(whoami):staff /usr/local/etc/netdata/claim.conf # Intel
62 chown $(whoami):staff /opt/homebrew/etc/netdata/claim.conf # Apple Silicon
63 chmod 0600 /usr/local/etc/netdata/claim.conf # Intel
64 chmod 0600 /opt/homebrew/etc/netdata/claim.conf # Apple Silicon
65 ```
66
67 This prevents the `chown: netdata: illegal group name` error.
68 Using `0600` is acceptable for Homebrew installs because the Netdata Agent runs under the same user that owns the file.
69
70 :::
71
72 **Configuration Options:**
73
74 | option | description | required |
75 |:--------:|:---------------------------------------------------------------------------------------|:--------:|
76 | url | The Netdata Cloud base URL (defaults to `https://app.netdata.cloud`) | no |
77 | token | The claiming token for your Netdata Cloud Space | yes |
78 | rooms | A comma-separated list of Rooms that the Agent will be added to | no |
79 | proxy | See [proxy configuration](#proxy-configuration) below | no |
80 | insecure | A boolean (either `yes`, or `no`) and when set to `yes` it disables host verification. | no |
81
82 **Applying the Configuration:**
83
84 If the Agent is already running, you can either run `netdatacli reload-claiming-state` or [restart the Agent](/docs/netdata-agent/start-stop-restart.md). Otherwise, the Agent connects when it starts.
85
86 ### Method 3: Via Environment Variables
87
88 **Best for:** Container deployments, CI/CD pipelines
89
90 You can configure Netdata using the following environment variables:
91
92 | Option | Description | Required |
93 |----------------------------|---------------------------------------------------------------------------------------------------|----------|
94 | `NETDATA_CLAIM_URL` | The Netdata Cloud base URL (defaults to `https://app.netdata.cloud`) | no |
95 | `NETDATA_CLAIM_TOKEN` | The claiming token for your Netdata Cloud Space | yes |
96 | `NETDATA_CLAIM_ROOMS` | A comma-separated list of Rooms that the Agent will be added to | no |
97 | `NETDATA_CLAIM_PROXY` | The URL of a proxy server to use for the connection | no |
98 | `NETDATA_EXTRA_CLAIM_OPTS` | May contain a space-separated list of options. The option `-insecure` is the only currently used. | no |
99
100 ### Connection Troubleshooting
101
102 If the connection process fails, you can find the reason in daemon.log (search for "CLAIM") and the `cloud` section of `http://ip:19999/api/v3/info`.
103
104 ## Advanced Configuration
105
106 ### Proxy Configuration
107
108 You can configure proxy settings for both the configuration file and environment variable methods.
109
110 #### For Configuration File (claim.conf)
111
112 You can set the `proxy` option at the `[global]` section in `claim.conf` to:
113
114 - empty, to disable proxy configuration
115 - `none` to disable proxy configuration
116 - `env` to use the environment variable `http_proxy` (this is the default)
117 - `http://[user:pass@]host:port`, to connect via a web proxy
118 - `socks5[h]://[user:pass@]host:port`, to connect via a SOCKS5 proxy
119
120 #### Environment Variable Proxy Settings
121
122 Netdata uses the `http_proxy` environment variable only when you set the `proxy` option to `env` (which is the default). You can set the `http_proxy` environment variable to:
123
124 - `http://[user:pass@]host:port`, to connect via an HTTP proxy
125 - `socks5[h]://[user:pass@]host:port`, to connect via a SOCKS5 or SOCKS5H proxy
126
127 #### Proxy Security Considerations
128
129 :::note
130
131 Netdata does not support secure connections to proxies. **Data between Netdata Agents and Netdata Cloud remains end-to-end encrypted** since the Agent establishes a TCP tunnel through the proxy (HTTP `CONNECT` for HTTP proxies, SOCKS5 `CONNECT` for SOCKS proxies) and handles all encryption directly, however initial Agent-to-proxy communication is not encrypted.
132
133 :::
134
135 **How End-to-End Encryption Works with Proxies:**
136
137 1. **Proxy Connection**: The Agent connects to the configured proxy using a plain TCP connection.
138 2. **TCP Tunneling Request**: The Agent asks the proxy to establish a TCP tunnel to the Netdata Cloud server (HTTP `CONNECT` for HTTP proxy, SOCKS5 `CONNECT` for SOCKS5/SOCKS5H).
139 3. **Proxy Tunneling**: Once accepted, the proxy forwards raw TCP data in both directions without interpreting application-layer traffic.
140 4. **Encrypted Communication**: The Agent then establishes a TLS/SSL connection through this tunnel directly with the Netdata Cloud server. All subsequent data (including the WebSocket handshake and MQTT protocol data) is encrypted end-to-end.
141
142 :::note
143
144 The proxy only sees encrypted TLS traffic flowing through the tunnel it established, never the decrypted content.
145
146 :::
147
148 :::info
149
150 Netdata uses **two connection libraries**: **libcurl for claiming and MQTToWSoHTTPS for the actual Cloud connection**. While libcurl supports encrypted proxy connections, MQTToWSoHTTPS does not - so encrypted proxy connections will fail during the Cloud connection phase. The proxy configuration patterns above work for both libraries and provide end-to-end encryption for Netdata Cloud communication.
151
152 For SOCKS proxies:
153 - `socks5://` resolves target hostnames locally on the Agent and sends IP to the proxy.
154 - `socks5h://` sends hostname to the proxy and resolves DNS remotely on the proxy side.
155
156 :::
157
158 ## Manage Connections
159
160 ### Reconnect Agent
161
162 <details>
163 <summary><strong>Linux-based Installations</strong></summary><br/>
164
165 To remove a node from your Space in Netdata Cloud, delete the `cloud.d/` directory in your Netdata library directory.
166
167 ```bash
168 cd /var/lib/netdata # Replace with your Netdata library directory, if not /var/lib/netdata/
169 sudo rm -rf cloud.d/
170 ```
171
172 :::note
173
174 The Agent will be **re-claimed automatically** if the environment variables or `claim.conf` exist when you restart the Agent.
175
176 :::
177
178 This node will no longer have access to the credentials it used when connecting to Netdata Cloud via the ACLK.
179
180 </details>
181
182 <details>
183 <summary><strong>Docker-based Installations</strong></summary><br/>
184
185 To remove a node from your Space and connect it to another, follow these steps:
186
187 1. **Enter the running container** you wish to remove from your Space
188
189 ```bash
190 docker exec -it CONTAINER_NAME sh
191 ```
192
193 Replace `CONTAINER_NAME` with either the container's name or ID.
194
195 2. **Delete the connection files**
196
197 ```bash
198 rm -rf /var/lib/netdata/cloud.d/
199 rm /var/lib/netdata/registry/netdata.public.unique.id
200 ```
201
202 3. **Stop and remove the container**
203
204 **Docker CLI:**
205 ```bash
206 docker stop CONTAINER_NAME
207 docker rm CONTAINER_NAME
208 ```
209 Replace `CONTAINER_NAME` with either the container's name or ID.
210
211 **Docker Compose:**
212 Inside the directory that has the `docker-compose.yml` file, run:
213 ```bash
214 docker compose down
215 ```
216
217 **Docker Swarm:**
218 Run the following, and replace `STACK` with your Stack's name:
219 ```bash
220 docker stack rm STACK
221 ```
222
223 4. **Connect to new Space**
224
225 Go to your new Space, copy the installation command with the new claim token and run it. If you're using a `docker-compose.yml` file, you will have to overwrite it with the new claiming token. The node should now appear online in that Space.
226
227 </details>
228
229 ### `cloud.d` Directory Contents
230
231 When an Agent is claimed to Netdata Cloud, the `cloud.d/` directory (located in your Netdata library directory, typically `/var/lib/netdata/cloud.d/`) stores the credentials and identity information for the Agent-Cloud Link (ACLK). The directory typically includes the following core files:
232
233 | File | Description |
234 |------|-------------|
235 | `cloud.conf` | Primary Cloud configuration file, including the canonical `claimed_id` and other ACLK settings |
236 | `private.pem` | RSA private key for ACLK authentication |
237 | `public.pem` | RSA public key for ACLK authentication |
238 | `claimed_id` | Legacy file duplicating the `claimed_id` from `cloud.conf`, kept mainly for backwards compatibility and fallback |
239
240 In addition to these, depending on your configuration and features in use, you may also see the following optional files:
241
242 - `token` / `rooms`: Used for split-file auto-claiming workflows.
243 - `trusted.pem` / `cloud_fullchain.pem`: Optional custom CA bundle files used to validate the TLS connection to Netdata Cloud.
244
245 :::note
246
247 The `claimed_id` is separate from the Machine GUID. It uniquely identifies the connection between the Agent and Cloud, while the Machine GUID identifies the node itself.
248
249 :::
250
251 For detailed explanations of all identity types and their relationships, see [Node Identities](/docs/learn/node-identities.md).
252
253 ### Regenerate Claiming Token
254
255 You may need to revoke your previous Claiming Token and generate a new one for security reasons.
256
257 :::note
258
259 Only **Administrators** of a Space in Netdata Cloud can regenerate Claim Tokens.
260
261 :::
262
263 **Steps:**
264
265 1. Navigate to [any screen](#quick-start---new-installation) containing the Connection command
266 2. Click the "Regenerate token" button. This action invalidates your previous token and generates a new one
267
268 ## Troubleshooting
269
270 ### Check Connection Status
271
272 If you're having trouble connecting a node, this may be because the [ACLK](/src/aclk/README.md) cannot connect to Cloud.
273
274 **Method 1: Web Interface**
275
276 With the Netdata Agent running, visit `http://NODE:19999/api/v3/info` in your browser, replacing `NODE` with the IP address or hostname of your Agent. The returned JSON contains a section called `cloud` with helpful information to diagnose any issues you might be having with the ACLK or connection process.
277
278 **Method 2: Command Line**
279
280 You can also run `sudo netdatacli aclk-state` to get some diagnostic information about ACLK:
281
282 ```bash
283 ACLK Available: Yes
284 ACLK Implementation: Next Generation
285 New Cloud Protocol Support: Yes
286 Claimed: Yes
287 Claimed Id: 53aa76c2-8af5-448f-849a-b16872cc4ba1
288 Online: Yes
289 Used Cloud Protocol: New
290 ```
291
292 Use these keys and the information below to troubleshoot the ACLK.
293
294 ### Common Issues
295
296 #### kickstart: unsupported Netdata installation
297
298 **Problem:** 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.
299
300 **Solution:** Check our [installation section](/packaging/installer/README.md) to find the proper way of installing Netdata on your system.
301
302 #### kickstart: Failed to write new machine GUID
303
304 **Problem:** You might encounter this error if you run the Netdata kickstart script without sufficient permissions:
305
306 ```bash
307 Failed to write new machine GUID. Please make sure you have rights to write to /var/lib/netdata/registry/netdata.public.unique.id.
308 ```
309
310 **Solution:** To resolve this issue, you have two options:
311
312 1. Run the script with root privileges.
313 2. Run the script with the user that runs the Netdata Agent.
314
315 #### Connecting to Cloud on older distributions (Ubuntu 14.04, Debian 8, CentOS 6)
316
317 **Problem:** If you're running an older Linux distribution or one that has reached EOL, such as Ubuntu 14.04 LTS, Debian 8, or CentOS 6, your Agent may not be able to securely connect to Netdata Cloud due to an outdated version of OpenSSL. These old versions of OpenSSL cannot perform [hostname validation](https://wiki.openssl.org/index.php/Hostname_validation), which helps securely encrypt SSL connections.
318
319 **Solution:** We recommend you reinstall Netdata with a [static build](/packaging/makeself/README.md), which uses an up-to-date version of OpenSSL with hostname validation enabled.
320
321 :::warning
322
323 If you choose to continue using the **outdated version of OpenSSL**, your node will still connect to Netdata Cloud, but **with hostname verification disabled**. Without verification, your Netdata Cloud connection could be vulnerable to man-in-the-middle attacks.
324
325 :::