Skip to content

Commit

Permalink
✨ add optional ServiceMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPsychick committed Dec 22, 2024
1 parent 78f590d commit 760a89a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sickhub/mtr-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: mtr-exporter
description: A Helm chart for an mtr-exporter pod providing metrics.
type: application
version: 0.0.1
version: 0.0.2
# https://github.com/mgumz/mtr-exporter
# https://github.com/mgumz/mtr-exporter/pkgs/container/mtr-exporter
appVersion: "0.4.0"
Expand Down
31 changes: 31 additions & 0 deletions sickhub/mtr-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "mtr-exporter.fullname" . }}
labels:
{{- include "mtr-exporter.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.defaults.labels }}
{{- toYaml .Values.serviceMonitor.defaults.labels | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: http
path: {{ .Values.serviceMonitor.path }}
interval: {{ .Values.serviceMonitor.defaults.interval }}
scrapeTimeout: {{ .Values.serviceMonitor.defaults.scrapeTimeout }}
honorTimestamps: {{ .Values.serviceMonitor.defaults.honorTimestamps }}
{{- if .Values.serviceMonitor.defaults.metricRelabelings }}
metricRelabelings:
{{ toYaml .Values.serviceMonitor.defaults.metricRelabelings | indent 6 }}
{{- end }}
{{- if .Values.serviceMonitor.defaults.additionalRelabelings }}
relabelings:
{{ toYaml .Values.serviceMonitor.defaults.additionalRelabelings | indent 6 }}
{{- end }}
jobLabel: "{{ .Release.Name }}"
selector:
matchLabels:
{{- include "mtr-exporter.labels" . | nindent 6 }}
{{- end }}
16 changes: 16 additions & 0 deletions sickhub/mtr-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ exporterJobs: []
# schedule: "@every 120s"
# mtrFlags: "-G 1 example.com"

serviceMonitor:
enabled: false
path: /metrics
defaults:
interval: 60s
scrapeTimeout: 3s
honorTimestamps: true
metricRelabelings: {}
# - sourceLabels: [instance]
# targetLabel: instance
# replacement: {{ .url }}
# action: replace
additionalRelabelings: {}
labels: {}
# prometheus: default

# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/
serviceAccount:
# Specifies whether a service account should be created
Expand Down

0 comments on commit 760a89a

Please sign in to comment.