From 09b26ced0df681e070aa3eb82995ff4d9b174304 Mon Sep 17 00:00:00 2001 From: Robin Scherrer Date: Mon, 22 Jul 2024 13:34:36 +0200 Subject: [PATCH] feat(teslamate): prometheusrule for db queries --- apps/teslamate/postgres/kustomization.yaml | 1 + apps/teslamate/postgres/prometheusrule.yaml | 26 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 apps/teslamate/postgres/prometheusrule.yaml diff --git a/apps/teslamate/postgres/kustomization.yaml b/apps/teslamate/postgres/kustomization.yaml index 6aff78ec5..ee52ca121 100644 --- a/apps/teslamate/postgres/kustomization.yaml +++ b/apps/teslamate/postgres/kustomization.yaml @@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: + - prometheusrule.yaml - postgres.yaml - scheduledbackup.yaml - configmap.yaml diff --git a/apps/teslamate/postgres/prometheusrule.yaml b/apps/teslamate/postgres/prometheusrule.yaml new file mode 100644 index 000000000..e09666bef --- /dev/null +++ b/apps/teslamate/postgres/prometheusrule.yaml @@ -0,0 +1,26 @@ +--- +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: teslamate-alerts + namespace: monitoring +spec: + groups: + - name: teslamate.rules + rules: + - alert: TeslaMateOpenDrives + annotations: + description: Unclosed drives found in TeslaMate + runbook_url: https://docs.teslamate.org/docs/maintenance/manually_fixing_data#terminate-a-drive-or-charge + expr: cnpg_open_drives_open_drives > 0 + for: 8h + labels: + severity: critical + - alert: TeslaMateIncompleteCharges + annotations: + description: Incomplete charges found in TeslaMate + runbook_url: https://docs.teslamate.org/docs/maintenance/manually_fixing_data#terminate-a-drive-or-charge + expr: cnpg_incomplete_charges_incomplete_charges > 0 + for: 8h + labels: + severity: critical