Skip to content

Commit 237942b

Browse files
authored
docs: Store prom sm scrape config on main (#34220)
<!-- Describe the contents of the PR briefly but completely. If you write detailed commit messages, it is acceptable to copy/paste them here, or write "see commit messages for details." If there is only one commit in the PR, GitHub will have already added its commit message above. --> It'd be nice to point it at the recent mz version tag, but unfortunately we'd need to wait for another release. For now just pointing it at main ### Motivation <!-- Which of the following best describes the motivation behind this PR? * This PR fixes a recognized bug. [Ensure issue is linked somewhere.] * This PR adds a known-desirable feature. [Ensure issue is linked somewhere.] * This PR fixes a previously unreported bug. [Describe the bug in detail, as if you were filing a bug report.] * This PR adds a feature that has not yet been specified. [Write a brief specification for the feature, including justification for its inclusion in Materialize, as if you were writing the original feature specification.] * This PR refactors existing code. [Describe what was wrong with the existing code, if it is not obvious.] --> ### Tips for reviewer <!-- Leave some tips for your reviewer, like: * The diff is much smaller if viewed with whitespace hidden. * [Some function/module/file] deserves extra attention. * [Some function/module/file] is pure code movement and only needs a skim. Delete this section if no tips. --> ### Checklist - [ ] This PR has adequate test coverage / QA involvement has been duly considered. ([trigger-ci for additional test/nightly runs](https://trigger-ci.dev.materialize.com/)) - [ ] This PR has an associated up-to-date [design doc](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/README.md), is a design doc ([template](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/00000000_template.md)), or is sufficiently small to not require a design. <!-- Reference the design in the description. --> - [ ] If this PR evolves [an existing `$T ⇔ Proto$T` mapping](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/command-and-response-binary-encoding.md) (possibly in a backwards-incompatible way), then it is tagged with a `T-proto` label. - [ ] If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label ([example](MaterializeInc/cloud#5021)). <!-- Ask in #team-cloud on Slack if you need help preparing the cloud PR. --> - [ ] If this PR includes major [user-facing behavior changes](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/guide-changes.md#what-changes-require-a-release-note), I have pinged the relevant PM to schedule a changelog post.
1 parent 6e85fc7 commit 237942b

File tree

3 files changed

+194
-3
lines changed

3 files changed

+194
-3
lines changed

doc/user/content/manage/monitor/self-managed/prometheus.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ This guide assumes you have administrative access to your Kubernetes cluster and
2929

3030
## 1. Download our Prometheus scrape configurations (`prometheus.yml`)
3131
Download the Prometheus scrape configurations that we'll use to configure Prometheus to collect metrics from Materialize:
32-
```bash
33-
curl -o prometheus_scrape_configs.yml https://raw.githubusercontent.com/MaterializeInc/materialize/refs/heads/self-managed-docs/v25.2/doc/user/data/monitoring/prometheus.yml
34-
```
32+
{{% self-managed/step-download-prometheus-scrape-configs %}}
33+
3534

3635

3736
## 2. Install Prometheus to your Kubernetes cluster
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
global:
2+
evaluation_interval: 1m
3+
scrape_interval: 1m
4+
scrape_timeout: 10s
5+
scrape_configs:
6+
- job_name: kubernetes-pods
7+
kubernetes_sd_configs:
8+
- role: pod
9+
relabel_configs:
10+
- action: keep
11+
regex: 'true'
12+
source_labels:
13+
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
14+
- action: replace
15+
regex: '(https?)'
16+
source_labels:
17+
- __meta_kubernetes_pod_annotation_prometheus_io_scheme
18+
target_label: __scheme__
19+
- action: replace
20+
regex: '(.+)'
21+
source_labels:
22+
- __meta_kubernetes_pod_annotation_prometheus_io_path
23+
target_label: __metrics_path__
24+
- action: replace
25+
regex: '([^:]+)(?::\d+)?;(\d+)'
26+
replacement: $1:$2
27+
source_labels:
28+
- __address__
29+
- __meta_kubernetes_pod_annotation_prometheus_io_port
30+
target_label: __address__
31+
- action: labelmap
32+
regex: '__meta_kubernetes_pod_annotation_prometheus_io_param_(.+)'
33+
replacement: __param_$1
34+
- action: labelmap
35+
regex: '__meta_kubernetes_pod_label_(.+)'
36+
- action: replace
37+
source_labels:
38+
- __meta_kubernetes_namespace
39+
target_label: kubernetes_namespace
40+
- action: replace
41+
source_labels:
42+
- __meta_kubernetes_pod_name
43+
target_label: kubernetes_pod_name
44+
- action: drop
45+
regex: 'Pending|Succeeded|Failed|Completed'
46+
source_labels:
47+
- __meta_kubernetes_pod_phase
48+
- job_name: kubernetes-pods-mz-compute
49+
kubernetes_sd_configs:
50+
- role: pod
51+
relabel_configs:
52+
- action: keep
53+
regex: "true"
54+
source_labels:
55+
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
56+
- action: replace
57+
regex: "(https?)"
58+
source_labels:
59+
- __meta_kubernetes_pod_annotation_prometheus_io_scheme
60+
target_label: __scheme__
61+
- action: replace
62+
regex: "(.+)"
63+
source_labels:
64+
- __meta_kubernetes_pod_annotation_materialize_prometheus_io_mz_compute_path
65+
target_label: __metrics_path__
66+
- action: replace
67+
regex: '([^:]+)(?::\d+)?;(\d+)'
68+
replacement: $1:$2
69+
source_labels:
70+
- __address__
71+
- __meta_kubernetes_pod_annotation_prometheus_io_port
72+
target_label: __address__
73+
- action: labelmap
74+
regex: "__meta_kubernetes_pod_annotation_prometheus_io_param_(.+)"
75+
replacement: __param_$1
76+
- action: labelmap
77+
regex: "__meta_kubernetes_pod_label_(.+)"
78+
- action: replace
79+
source_labels:
80+
- __meta_kubernetes_namespace
81+
target_label: kubernetes_namespace
82+
- action: replace
83+
source_labels:
84+
- __meta_kubernetes_pod_name
85+
target_label: kubernetes_pod_name
86+
- action: drop
87+
regex: "Pending|Succeeded|Failed|Completed"
88+
source_labels:
89+
- __meta_kubernetes_pod_phase
90+
- job_name: kubernetes-pods-mz-storage
91+
kubernetes_sd_configs:
92+
- role: pod
93+
relabel_configs:
94+
- action: keep
95+
regex: "true"
96+
source_labels:
97+
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
98+
- action: replace
99+
regex: "(https?)"
100+
source_labels:
101+
- __meta_kubernetes_pod_annotation_prometheus_io_scheme
102+
target_label: __scheme__
103+
- action: replace
104+
regex: "(.+)"
105+
source_labels:
106+
- __meta_kubernetes_pod_annotation_materialize_prometheus_io_mz_storage_path
107+
target_label: __metrics_path__
108+
- action: replace
109+
regex: '([^:]+)(?::\d+)?;(\d+)'
110+
replacement: $1:$2
111+
source_labels:
112+
- __address__
113+
- __meta_kubernetes_pod_annotation_prometheus_io_port
114+
target_label: __address__
115+
- action: labelmap
116+
regex: "__meta_kubernetes_pod_annotation_prometheus_io_param_(.+)"
117+
replacement: __param_$1
118+
- action: labelmap
119+
regex: "__meta_kubernetes_pod_label_(.+)"
120+
- action: replace
121+
source_labels:
122+
- __meta_kubernetes_namespace
123+
target_label: kubernetes_namespace
124+
- action: replace
125+
source_labels:
126+
- __meta_kubernetes_pod_name
127+
target_label: kubernetes_pod_name
128+
- action: drop
129+
regex: "Pending|Succeeded|Failed|Completed"
130+
source_labels:
131+
- __meta_kubernetes_pod_phase
132+
- job_name: kubernetes-pods-mz-usage
133+
kubernetes_sd_configs:
134+
- role: pod
135+
relabel_configs:
136+
- action: keep
137+
regex: "true"
138+
source_labels:
139+
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
140+
- action: replace
141+
regex: "(https?)"
142+
source_labels:
143+
- __meta_kubernetes_pod_annotation_prometheus_io_scheme
144+
target_label: __scheme__
145+
- action: replace
146+
regex: "(.+)"
147+
source_labels:
148+
- __meta_kubernetes_pod_annotation_materialize_prometheus_io_mz_usage_path
149+
target_label: __metrics_path__
150+
- action: replace
151+
regex: '([^:]+)(?::\d+)?;(\d+)'
152+
replacement: $1:$2
153+
source_labels:
154+
- __address__
155+
- __meta_kubernetes_pod_annotation_prometheus_io_port
156+
target_label: __address__
157+
- action: labelmap
158+
regex: "__meta_kubernetes_pod_annotation_prometheus_io_param_(.+)"
159+
replacement: __param_$1
160+
- action: labelmap
161+
regex: "__meta_kubernetes_pod_label_(.+)"
162+
- action: replace
163+
source_labels:
164+
- __meta_kubernetes_namespace
165+
target_label: kubernetes_namespace
166+
- action: replace
167+
source_labels:
168+
- __meta_kubernetes_pod_name
169+
target_label: kubernetes_pod_name
170+
- action: drop
171+
regex: "Pending|Succeeded|Failed|Completed"
172+
source_labels:
173+
- __meta_kubernetes_pod_phase
174+
- job_name: 'kubelet-cadvisor'
175+
scheme: https
176+
kubernetes_sd_configs:
177+
- role: node
178+
tls_config:
179+
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
180+
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
181+
relabel_configs:
182+
- action: labelmap
183+
regex: __meta_kubernetes_node_label_(.+)
184+
- target_label: __address__
185+
replacement: kubernetes.default.svc:443
186+
- source_labels: [__meta_kubernetes_node_name]
187+
regex: (.+)
188+
target_label: __metrics_path__
189+
replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```shell
2+
curl -o prometheus_scrape_configs.yml https://raw.githubusercontent.com/MaterializeInc/materialize/refs/heads/main/doc/user/data/self_managed/monitoring/prometheus.yml
3+
```

0 commit comments

Comments
 (0)