From 4f7d8489e5d50ed3065342135b6d987d21b0d444 Mon Sep 17 00:00:00 2001
From: Varac <varac@varac.net>
Date: Wed, 1 Dec 2021 14:50:52 +0100
Subject: [PATCH] Use only container label for mem usage query

---
 flux2/config/monitoring/stackspin-alerts-prometheusrule.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flux2/config/monitoring/stackspin-alerts-prometheusrule.yaml b/flux2/config/monitoring/stackspin-alerts-prometheusrule.yaml
index 9a2f8d4cf..0acd5cebd 100644
--- a/flux2/config/monitoring/stackspin-alerts-prometheusrule.yaml
+++ b/flux2/config/monitoring/stackspin-alerts-prometheusrule.yaml
@@ -68,10 +68,10 @@ spec:
 
       # https://awesome-prometheus-alerts.grep.to/rules#rule-docker-containers-1-4
       - alert: ContainerMemoryUsage
-        expr: (sum(container_memory_working_set_bytes) BY (instance, name) / sum(container_spec_memory_limit_bytes > 0) BY (instance, name) * 100) > 80
+        expr: (sum(container_memory_working_set_bytes) BY (container) / sum(container_spec_memory_limit_bytes > 0) BY (container) * 100) > 80
         for: 2m
         labels:
           severity: warning
         annotations:
-          summary: Container Memory usage (instance {{ $labels.instance }})
+          summary: Container Memory usage ({{ $labels.container }})
           description: "Container Memory usage is above 80%\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
-- 
GitLab