fix(infra-monitoring): enable servicemonitor for karma

This commit is contained in:
WrenIX 2024-07-23 17:44:19 +02:00
parent 75c774d559
commit fbdda11e5a
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,32 @@
{{- if and .Values.karma.enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule") }}
---
apiVersion: "monitoring.coreos.com/v1"
kind: "PrometheusRule"
metadata:
name: karma
labels:
{{- toYaml .Values.commons.prometheus.rules.labels | nindent 4 }}
spec:
groups:
- name: "Karma"
rules:
- alert: "Karma scrape alertmanager"
expr: 'sum(karma_alertmanager_up) == 0'
for: "5m"
labels:
severity: "critical"
annotations:
{{`
summary: "No Alertmanager is reachable for more than 5 minutes."
`}}
- alert: "Karma scrape alertmanager"
expr: 'max(karma_alertmanager_up) by (alertmanager) == 0'
for: "5m"
labels:
severity: "warning"
annotations:
{{`
summary: "Alertmanager {{ $labels.alertmanager }} is not reachable for more than 5 minutes."
`}}
{{- end }}

View file

@ -140,4 +140,8 @@ spec:
{{- end }}
{{- end }}
{{- end }}{{/* end-with karma.ingress */}}
serviceMonitor:
enabled: {{ (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }}
additionalLabels:
{{- toYaml .Values.commons.prometheus.monitor.labels | nindent 8 }}
{{- end }}