From e1ddbc7495a70c31bc7e75eac0e464a0d76d65db Mon Sep 17 00:00:00 2001 From: Jonathan Gazeley Date: Wed, 28 Aug 2024 23:32:20 +0100 Subject: [PATCH] Add serviceMonitor --- .../templates/servicemonitor.yaml | 28 +++++++++++++++++++ dist/charts/ping-exporter/values.yaml | 4 +++ 2 files changed, 32 insertions(+) create mode 100644 dist/charts/ping-exporter/templates/servicemonitor.yaml diff --git a/dist/charts/ping-exporter/templates/servicemonitor.yaml b/dist/charts/ping-exporter/templates/servicemonitor.yaml new file mode 100644 index 0000000..86ae438 --- /dev/null +++ b/dist/charts/ping-exporter/templates/servicemonitor.yaml @@ -0,0 +1,28 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "ping_exporter.fullname" . }} + labels: + {{- include "ping_exporter.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "ping_exporter.selectorLabels" . | nindent 6 }} + endpoints: + - port: http + interval: 60s + relabelings: + - action: labeldrop + regex: pod + sourceLabels: [] + - action: labeldrop + regex: namespace + sourceLabels: [] + - action: labeldrop + regex: instance + sourceLabels: [] + - action: labeldrop + regex: job + sourceLabels: [] +{{- end }} diff --git a/dist/charts/ping-exporter/values.yaml b/dist/charts/ping-exporter/values.yaml index 3429316..f4e4e58 100644 --- a/dist/charts/ping-exporter/values.yaml +++ b/dist/charts/ping-exporter/values.yaml @@ -101,3 +101,7 @@ config: timeout: 3s history-size: 42 payload-size: 120 + +# Create a serviceMonitor resource to be consumed by Prometheus Operator +serviceMonitor: + enabled: false