Skip to content

Commit ef9d3a4

Browse files
committed
add metrics info
1 parent 4daf151 commit ef9d3a4

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ Specifies the verbosity of logging for the local `cloudflared` instance. Availab
8181

8282
| Syntax | Default | Environment Variable |
8383
| ----------------------------------------------------------- | ------------ | -------------------- |
84-
| `cloudflared tunnel --metrics <IP:PORT> run <UUID or NAME>` | `localhost:` | `TUNNEL_METRICS` |
84+
| `cloudflared tunnel --metrics <IP:PORT> run <UUID or NAME>` | Refer to [Tunnel metrics](/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics/)| `TUNNEL_METRICS` |
8585

86-
Exposes a Prometheus endpoint on the specified IP address/port, which you can then query for [usage metrics](/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics/).
86+
Exposes a Prometheus endpoint on the specified IP address and port, which you can then query for [usage metrics](/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics/).
8787

8888
## `no-autoupdate`
8989

src/content/docs/cloudflare-one/connections/connect-networks/monitor-tunnels/metrics.mdx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,37 @@ sidebar:
66
head:
77
- tag: title
88
content: Tunnel metrics
9-
tableOfContents: false
109
---
1110

12-
Tunnel metrics show a Cloudflare Tunnel's throughput and resource usage over time. When you run a tunnel, you can configure `cloudflared` to spin up a Prometheus metrics endpoint — an HTTP server that exposes metrics in [Prometheus](https://prometheus.io/docs/introduction/overview/) format. You can then use the Prometheus toolkit on a remote machine to scrape metrics data from the `cloudflared` server.
11+
Tunnel metrics show a Cloudflare Tunnel's throughput and resource usage over time. When you run a tunnel, `cloudflared` will spin up a Prometheus metrics endpoint — an HTTP server that exposes metrics in [Prometheus](https://prometheus.io/docs/introduction/overview/) format. You can use the Prometheus toolkit on a remote machine to scrape metrics data from the `cloudflared` server.
1312

14-
## Start the metrics server
13+
## Default metrics server address
1514

16-
Perform these steps on the `cloudflared` server.
15+
In non-containerized environments, `cloudflared` starts the metrics server on `127.0.0.1:<PORT>/metrics`, where `<PORT>` is the first available port in the range `20241` to `20245`. In case of all ports being unavailable then the fallback is to bind to a random port. In containerized environments such as Docker and Kubernetes, the default address is `0.0.0.0:<PORT>/metrics`.
1716

18-
1. Use the [--metrics](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters/#metrics) flag to create a metrics endpoint at the specified IP address and port. Here is an example command for a locally-managed tunnel:
17+
## Check the metrics server address
18+
19+
To determine the metrics server address that is being used by a `cloudflared` instance, check your [Tunnel logs](/cloudflare-one/connections/connect-networks/monitor-tunnels/logs/) around the time when the tunnel started. For example:
20+
21+
```text
22+
2024-12-19T21:17:58Z INF Starting metrics server on 127.0.0.1:20241/metrics
23+
```
24+
25+
## Configure the metrics server address
26+
27+
To serve metrics on a custom IP address and port, perform these steps on the `cloudflared` host:
28+
29+
1. Run the tunnel using the [--metrics](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters/#metrics) flag. Here is an example command for a locally-managed tunnel:
1930

2031
```sh
2132
cloudflared tunnel --metrics 127.0.0.1:60123 run my-tunnel
2233
```
2334

2435
To learn how to add the `--metrics` flag to a remotely-managed tunnel, refer to [Configure a remotely-managed tunnel](/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management/#add-tunnel-run-parameters).
2536

26-
:::note
27-
28-
If you plan to fetch metrics from another machine on the local network, replace `127.0.0.1` with the internal IP of the `cloudflared` server (for example, `198.168.x.x`). To serve metrics on all available network interfaces, use `0.0.0.0`.
29-
:::
37+
:::note
38+
If you plan to fetch metrics from another machine on the local network, replace `127.0.0.1` with the internal IP of the `cloudflared` server (for example, `198.168.x.x`). To serve metrics on all available network interfaces, use `0.0.0.0`.
39+
:::
3040

3141
2. Verify that the metrics server is running by going to `http://localhost:60123/metrics`. This will only work if you configured a localhost IP (`127.0.0.1` or `0.0.0.0`).
3242

0 commit comments

Comments
 (0)