|
1 | 1 | ---
|
2 | 2 | # cSpell:ignore XPOST tsdb
|
3 | 3 |
|
4 |
| -title: Configure Metrics |
| 4 | +title: Metrics in Pomerium |
5 | 5 | sidebar_label: Metrics
|
6 |
| -description: Use Prometheus as a metrics data store. |
| 6 | +description: Learn how Pomerium collects and displays metrics in Pomerium Zero and Pomerium Enterprise. |
7 | 7 | lang: en-US
|
8 |
| -keywords: [pomerium, enterprise pomerium, telemetry, metrics, prometheus] |
| 8 | +keywords: |
| 9 | + [pomerium, pomerium enterprise, telemetry, metrics, prometheus, pomerium zero] |
9 | 10 | ---
|
10 | 11 |
|
11 |
| -Pomerium Enterprise uses Prometheus as a metrics collection back-end. You can configure Pomerium and the Console to talk to an existing Prometheus server, or configure the embedded Prometheus backend. This guide assumes you're running both Pomerium and Pomerium Enterprise on localhost `127.0.0.1`. |
| 12 | +import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; |
12 | 13 |
|
13 |
| -:::tip |
| 14 | +Metrics in Pomerium provide observability and monitoring data from your Pomerium deployment. Use metrics to review traffic and its effects on your system. |
14 | 15 |
|
15 |
| -For production deployments, we suggest using a dedicated Prometheus instance. |
| 16 | +Pomerium exposes standard Prometheus metrics related to its operation. Open-source users must [configure](/docs/reference/metrics) metrics collection and visualization manually. |
| 17 | + |
| 18 | +Pomerium Zero and Pomerium Enterprise provide simplified, built-in metrics collection and visualizations. |
| 19 | + |
| 20 | +## Metrics definitions |
| 21 | + |
| 22 | +- **Traffic**: requests proxied by Pomerium to routes defined in a Pomerium deployment. |
| 23 | +- **Route**: the location of an upstream service protected behind Pomerium. At a minimum, a route consists of a [From](/docs/reference/routes/from) URL and a [To](/docs/reference/routes/to) URL. |
| 24 | + |
| 25 | +## How metrics work |
| 26 | + |
| 27 | +Pomerium collects and aggregates traffic data from your Pomerium deployment. This data includes the: |
| 28 | + |
| 29 | +- request size, duration, and rate |
| 30 | +- number of authorized and denied requests |
| 31 | +- response code distribution |
| 32 | + |
| 33 | +You can view and filter this data in your traffic dashboard to gauge how much demand is placed on your server. |
| 34 | + |
| 35 | +### Filter metrics |
| 36 | + |
| 37 | +#### Time range and routes |
| 38 | + |
| 39 | +Pomerium stores traffic metrics up to the last 30 days of usage. You can filter traffic by time range and routes. |
| 40 | + |
| 41 | +The following time ranges are supported: |
| 42 | + |
| 43 | +- Last 30 days |
| 44 | +- Last 2 weeks |
| 45 | +- Last 7 days |
| 46 | +- Last 24 hours |
| 47 | +- Last 12 hours |
| 48 | +- Last 3 hours |
| 49 | +- Last hour |
| 50 | +- Last 15 minutes (Enterprise only) |
| 51 | + |
| 52 | +When filtering by route, select: |
| 53 | + |
| 54 | +- **All Routes** to review aggregated traffic metrics across all routes defined in your Pomerium deployment. |
| 55 | +- an individual route to review aggregated traffic metrics for that route. |
| 56 | + |
| 57 | +<Tabs> |
| 58 | +<TabItem label="Zero" value="zero"> |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +</TabItem> |
| 63 | +<TabItem label="Enterprise" value="enterprise"> |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +</TabItem> |
| 68 | +</Tabs> |
| 69 | + |
| 70 | +## Traffic dashboard |
| 71 | + |
| 72 | +<Tabs> |
| 73 | +<TabItem value="zero" label="Zero"> |
| 74 | + |
| 75 | +Pomerium Zero collects traffic metrics at the [cluster](/docs/concepts/clusters) level, which includes active replicas. To review the traffic dashboard in Pomerium Zero: |
| 76 | + |
| 77 | +1. In the left-hand sidebar, select **Reports**. |
| 78 | +1. Select **Traffic**. |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +</TabItem> |
| 83 | +<TabItem value="enterprise" label="Enterprise"> |
| 84 | + |
| 85 | +When you access the Enterprise Console, you'll land on the traffic dashboard. Pomerium Enterprise organizes traffic metrics in your deployment with [namespaces](/docs/capabilities/namespacing). |
| 86 | + |
| 87 | +Namespaces follow a hierarchical system. You can view traffic metrics for all namespaces, or a specific namespace, using the namespace dropdown menu. You can filter by: |
| 88 | + |
| 89 | +- Global namespace, which encompasses all namespaces in your deployment. |
| 90 | +- Parent namespace, which includes child namespaces (if any). |
| 91 | +- Child namespace, which displays metrics only for that namespace. |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +:::enterprise |
| 96 | + |
| 97 | +In Pomerium Enterprise, you must configure metrics before you can view them. Metrics are not enabled by default, and are not required to run Pomerium Enterprise. See the [Configure Metrics](/docs/enterprise/configure-metrics) guide to enable metrics in your Enterprise deployment. |
16 | 98 |
|
17 | 99 | :::
|
18 | 100 |
|
19 |
| -## Prepare Pomerium |
| 101 | +</TabItem> |
| 102 | +</Tabs> |
| 103 | + |
| 104 | +### Total and Authorized requests |
| 105 | + |
| 106 | +<Tabs> |
| 107 | +<TabItem value="zero" label="Zero"> |
| 108 | + |
| 109 | +The **Total requests** chart shows the total number of proxied requests. The **Authorized requests** chart shows the total number of requests Pomerium authorized and forwarded to an upstream service. |
| 110 | + |
| 111 | +Both charts display the difference in requests between the selected and previous time ranges.  |
| 112 | + |
| 113 | +The **Authorized Requests** pie chart displays the total number of authorized and denied requests.  |
| 114 | + |
| 115 | +</TabItem> |
| 116 | +<TabItem value="enterprise" label="Enterprise"> |
| 117 | + |
| 118 | +The **Total requests** chart shows the total number of proxied requests. The **Authorized requests** chart shows the total number of requests Pomerium authorized and forwarded to an upstream service. |
| 119 | + |
| 120 | +The **Healthy Endpoints** chart displays the number of healthy upstream endpoints, and roughly correlates with the number of routes defined in your deployment. |
| 121 | + |
| 122 | +For example, if a route's **To** definition includes [multiple upstream resources](/docs/reference/routes/to#target-multiple-upstream-resources), Pomerium includes these resources in the total sum of healthy endpoints. Pomerium excludes unhealthy endpoints from this total. See Load Balancing - [Active Health Checks](/docs/capabilities/load-balancing#active-health-checks) and [Passive Health Checks](/docs/capabilities/load-balancing#passive-health-checks) for more information. |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | +The **Authorized Requests** pie chart displays the total number of authorized and denied requests. |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | +The **Healthy Upstream Endpoints** graph shows you the number of healthy endpoints over time. A dip in the graph denotes unhealthy endpoints. |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | +</TabItem> |
| 135 | +</Tabs> |
| 136 | + |
| 137 | +### Request durations |
| 138 | + |
| 139 | +<Tabs> |
| 140 | +<TabItem value="zero" label="Zero"> |
| 141 | + |
| 142 | +Request duration measures the amount of time it takes Pomerium to proxy a request in milliseconds (ms). Pomerium Zero provides two request duration charts: |
| 143 | + |
| 144 | +The first chart organizes requests by duration ranges defined along the x-axis. Pomerium sums the total value of requests within each range and calculates the amount as a percentage value. |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | +The second chart organizes requests by percentile ranges, date, and time. |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | +</TabItem> |
| 153 | +<TabItem value="enterprise" label="Enterprise"> |
| 154 | + |
| 155 | +Request duration measures the amount of time it takes Pomerium to proxy a request in milliseconds (ms). Pomerium Enterprise provides two request duration charts: |
| 156 | + |
| 157 | +The first chart organizes requests by duration ranges defined along the x-axis. Pomerium sums the total value of requests within each range and calculates the amount as a percentage value. |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | +The second chart organizes requests by percentile ranges, date, and time. You can select a specific percentile range to view more granular data in that range: |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | +</TabItem> |
| 166 | +</Tabs> |
| 167 | + |
| 168 | +### Requests rate and response codes |
| 169 | + |
| 170 | +<Tabs> |
| 171 | +<TabItem value="zero" label="Zero"> |
| 172 | + |
| 173 | +The **Requests per second** chart calculates the average amount of proxied requests per second over the span of an hour. Requests are organized by date and time, and categorized by the following response status codes: |
| 174 | + |
| 175 | +- **200s** (200-299): successful responses |
| 176 | +- **300s** (300-399): redirection messages |
| 177 | +- **400s** (400-499): client error responses |
| 178 | +- **500s** (500-599): server error responses |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | +</TabItem> |
| 183 | +<TabItem value="enterprise" label="Enterprise"> |
| 184 | + |
| 185 | +The **Request Rate** chart calculates the average amount of proxied requests per second over the span of an hour. |
20 | 186 |
|
21 |
| -1. In the Pomerium `pomerium-config.yaml`, define the [`metrics_address`](/docs/reference/metrics#metrics-address) key to a network interface and/or port. For example: |
| 187 | + |
22 | 188 |
|
23 |
| - ```yaml title="pomerium-config.yaml" |
24 |
| - metrics_address: 127.0.0.1:9091 |
25 |
| - ``` |
| 189 | +The **Response Codes** chart organizes requests by date and time, and categorizes them with the following response status codes: |
26 | 190 |
|
27 |
| - The example above has Pomerium providing metrics at port `9999` on an IP address reachable by the Pomerium Console service. |
| 191 | +- **HTTP 2xx** (200-299): successful responses |
| 192 | +- **HTTP 3xx** (300-399): redirection messages |
| 193 | +- **HTTP 4xx** (400-499): client error responses |
| 194 | +- **HTTP 5xx** (500-599): server error responses |
28 | 195 |
|
29 |
| - If you're running Pomerium Enterprise in a distributed environment where the IP address is not known at the time of deployment, you can use the resolvable FQDN of the Pomerium host (`pomerium0.internal.example.com`, for example), or override this key with the environment variable `METRICS_ADDRESS`. We do not recommend exposing this endpoint to public traffic as it can contain potentially sensitive information. |
| 196 | + |
30 | 197 |
|
31 |
| -1. In the Pomerium Enterprise `pomerium-enterprise-config.yaml`, define the `metrics_addr` key to a network interface and/or port. For example: |
| 198 | +</TabItem> |
| 199 | +</Tabs> |
32 | 200 |
|
33 |
| - ```yaml title="config.yaml" |
34 |
| - metrics_addr: 127.0.0.1:9092 |
35 |
| - ``` |
| 201 | +### Bytes sent and received, request size |
36 | 202 |
|
37 |
| -## External Prometheus |
| 203 | +<Tabs> |
| 204 | +<TabItem value="zero" label="Zero"> |
38 | 205 |
|
39 |
| -1. Add the listener to your Prometheus configuration, usually via `prometheus.yml`: |
| 206 | +The **Bytes sent** and **Bytes received** charts display the average amount of bytes sent and received over the span of an hour. |
40 | 207 |
|
41 |
| - ```yaml |
42 |
| - - job_name: 'Pomerium' |
43 |
| - scrape_interval: 30s |
44 |
| - scrape_timeout: 5s |
45 |
| - static_configs: |
46 |
| - - targets: ['127.0.0.1:9901'] |
47 |
| - - job_name: 'Pomerium Enterprise' |
48 |
| - scrape_interval: 30s |
49 |
| - scrape_timeout: 5s |
50 |
| - static_configs: |
51 |
| - - targets: ['127.0.0.1:9902'] |
| 208 | + |
52 | 209 |
|
53 |
| - ``` |
| 210 | +</TabItem> |
| 211 | +<TabItem value="enterprise" label="Enterprise"> |
54 | 212 |
|
55 |
| -1. [Reload](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration) the Prometheus configuration: |
| 213 | +The **Request Size** chart organizes requests based on their request size measured in kilobytes (KB). |
56 | 214 |
|
57 |
| - ```bash |
58 |
| - curl -i -XPOST path.to.prometheus:port/-/reload |
59 |
| - ``` |
| 215 | + |
60 | 216 |
|
61 |
| -1. In the Pomerium Enterprise `config.yaml` file, define the `prometheus_url` key to point to your Prometheus instance(s): |
| 217 | +</TabItem> |
| 218 | +</Tabs> |
62 | 219 |
|
63 |
| - ```yaml |
64 |
| - prometheus_url: http://192.168.122.50:9090 |
65 |
| - ``` |
| 220 | +## Runtime dashboard |
66 | 221 |
|
67 |
| -1. Restart the Pomerium and Pomerium Enterprise services. You should now see route traffic and External Data Source monitoring data in the Enterprise Console: |
| 222 | +<Tabs> |
| 223 | +<TabItem value="zero" label="Zero"> |
68 | 224 |
|
69 |
| -   |
| 225 | +Runtime metrics are not supported in Pomerium Zero. |
70 | 226 |
|
71 |
| -## Embedded Prometheus |
| 227 | +</TabItem> |
| 228 | +<TabItem value="enterprise" label="Enterprise"> |
72 | 229 |
|
73 |
| -To take advantage of Prometheus embedded in Pomerium Enterprise, edit Pomerium Console's config file: |
| 230 | +In the **Runtime** dashboard, you can monitor how many system resources Pomerium is consuming. Filter by date range, service, and instance. |
74 | 231 |
|
75 |
| -```yaml title="config.yaml" |
76 |
| -prometheus_data_dir: /var/lib/pomerium-console/tsdb |
77 |
| -``` |
| 232 | + |
78 | 233 |
|
79 |
| -The directory path can be any location that the `pomerium` system user can write to. The example above uses the default location created by the [OS packages](/docs/enterprise/quickstart). |
| 234 | +</TabItem> |
| 235 | +</Tabs> |
0 commit comments