How to config alertmanager which installed by helm on kubernetes?
The alerts
and rules
keys in the serverFiles
group of the values.yaml
file are mounted in the Prometheus container in the /etc/config
folder. You can put in there the configuration you want (for example take inspiration by the blog post you linked) and it will be used by Prometheus to handle the alerts.
For example, a simple rule could be set like this:
serverFiles: alerts: | ALERT cpu_threshold_exceeded IF (100 * (1 - avg by(job)(irate(node_cpu{mode='idle'}[5m])))) > 80 FOR 300s LABELS { severity = "warning", } ANNOTATIONS { summary = "CPU usage > 80% for {{ $labels.job }}", description = "CPU usage avg for last 5m: {{ $value }}", }