Skip to content

Commit 2188c47

Browse files
LinPrzeritti
andauthored
[prometheus-mongodb-exporter] Support custom serviceMonitor scrape metrics path (#6045)
Signed-off-by: LinPr <[email protected]> Signed-off-by: Lin <[email protected]> Co-authored-by: zeritti <[email protected]>
1 parent 22ef266 commit 2188c47

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

charts/prometheus-mongodb-exporter/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ maintainers:
1818
name: prometheus-mongodb-exporter
1919
sources:
2020
- https://github.com/percona/mongodb_exporter
21-
version: 3.12.1
21+
version: 3.13.0

charts/prometheus-mongodb-exporter/templates/NOTES.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ Verify the application is working by running these commands:
22
{{if contains "NodePort" .Values.service.type }}
33
NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
44
NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "prometheus-mongodb-exporter.fullname" . }})
5-
curl http://$NODE_IP:$NODE_PORT/metrics
5+
curl http://$NODE_IP:$NODE_PORT{{ .Values.serviceMonitor.telemetryPath }}
66
{{- else if contains "LoadBalancer" .Values.service.type }}
77
# NOTE: It may take a few minutes for the LoadBalancer IP to be available.
88
SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "prometheus-mongodb-exporter.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
9-
curl http://$SERVICE_IP:{{ .Values.service.port }}/metrics
9+
curl http://$SERVICE_IP:{{ .Values.service.port }}{{ .Values.serviceMonitor.telemetryPath }}
1010
{{- else if contains "ClusterIP" .Values.service.type }}
1111
kubectl port-forward service/{{ include "prometheus-mongodb-exporter.fullname" . }} {{ .Values.service.port }}
12-
curl http://127.0.0.1:{{ .Values.service.port }}/metrics
12+
curl http://127.0.0.1:{{ .Values.service.port }}{{ .Values.serviceMonitor.telemetryPath }}
1313
{{- end }}

charts/prometheus-mongodb-exporter/templates/servicemonitor.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ spec:
4444
{{- end }}
4545
{{- else }}
4646
- port: {{ .Values.service.portName }}
47+
path: {{ .Values.serviceMonitor.telemetryPath }}
4748
interval: {{ .Values.serviceMonitor.interval }}
4849
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
4950
{{- with .Values.serviceMonitor.metricRelabelings }}

charts/prometheus-mongodb-exporter/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ service:
9494
type: ClusterIP
9595
portName: metrics
9696

97+
9798
serviceAccount:
9899
create: true
99100
# If create is true and name is not set, then a name is generated using the
@@ -133,6 +134,7 @@ serviceMonitor:
133134
metricRelabelings: []
134135
scheme: ""
135136
tlsConfig: {}
137+
telemetryPath: /metrics
136138

137139
tolerations: []
138140

0 commit comments

Comments
 (0)