From 3f631e045d9ddde29b7b88986f9f44cca88f9b7d Mon Sep 17 00:00:00 2001 From: wwya Date: Mon, 23 Mar 2026 10:01:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20docker-compose/prometheus/?= =?UTF-8?q?promtheus/config/rules/container.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promtheus/config/rules/container.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docker-compose/prometheus/promtheus/config/rules/container.yaml diff --git a/docker-compose/prometheus/promtheus/config/rules/container.yaml b/docker-compose/prometheus/promtheus/config/rules/container.yaml new file mode 100644 index 0000000..741d0d1 --- /dev/null +++ b/docker-compose/prometheus/promtheus/config/rules/container.yaml @@ -0,0 +1,28 @@ +groups: + - name: container + interval: 15s + rules: + - alert: ContainerKilled + expr: time() - container_last_seen > 60 + for: 0m + labels: + severity: warning + annotations: + summary: Container killed (instance {{ $labels.instance }}) + description: "A container has disappeared\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" + - alert: ContainerHighCpuUtilization + expr: (sum(rate(container_cpu_usage_seconds_total{container!=""}[5m])) by (pod, container) / sum(container_spec_cpu_quota{container!=""}/container_spec_cpu_period{container!=""}) by (pod, container) * 100) > 80 + for: 2m + labels: + severity: warning + annotations: + summary: Container High CPU utilization (instance {{ $labels.instance }}) + description: "Container CPU utilization is above 80%\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" + - alert: ContainerHighMemoryUsage + expr: (sum(container_memory_working_set_bytes{name!=""}) BY (instance, name) / sum(container_spec_memory_limit_bytes > 0) BY (instance, name) * 100) > 80 + for: 2m + labels: + severity: warning + annotations: + summary: Container High Memory usage (instance {{ $labels.instance }}) + description: "Container Memory usage is above 80%\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" \ No newline at end of file