Fix ContainerHighMemory alert: skip containers with no memory limit

Containers without a memory limit have spec_memory_limit_bytes=0,
causing division to produce +Inf which always fires. Added guard:
only alert when a limit is actually set (> 0).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-01 03:54:16 -05:00
parent 15f5c267e7
commit 92427291e6

View file

@ -151,7 +151,10 @@ groups:
description: "Container CPU usage above 80% for 10 minutes." description: "Container CPU usage above 80% for 10 minutes."
- alert: ContainerHighMemory - alert: ContainerHighMemory
expr: container_memory_usage_bytes{name=~"performancewest-.*"} / container_spec_memory_limit_bytes{name=~"performancewest-.*"} * 100 > 85 expr: |
(container_memory_usage_bytes{name=~"performancewest-.*"}
/ container_spec_memory_limit_bytes{name=~"performancewest-.*"} * 100 > 85)
and container_spec_memory_limit_bytes{name=~"performancewest-.*"} > 0
for: 5m for: 5m
labels: labels:
severity: warning severity: warning