Files
metrics-prometheus-grafana/templates/alerts.rules.yml.j2
T

30 lines
1.3 KiB
Django/Jinja
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
groups:
- name: main
rules:
# Алерт 1: Сервер недоступен
- alert: InstanceDown
expr: up == 0
for: 1m
annotations:
description: "{% raw %}Сервер {{ $labels.instance }} недоступен{% endraw %}"
# Алерт 2: Высокая загрузка CPU (любой сервер)
- alert: HighCpuLoad
expr: (1 - avg by(instance)(rate(node_cpu_seconds_total{mode="idle"}[1m]))) * 100 > 80
for: 1m
annotations:
description: >-
{% raw %}Сервер {{ $labels.instance }}: загрузка CPU {{ printf "%.1f" $value }}% (порог 80%){% endraw %}
# Алерт 3: Высокий трафик на general_server (сумма вход + выход > 10 МБ/с)
- alert: HighNetworkTraffic
expr: >-
sum by(instance) (
rate(node_network_receive_bytes_total{nodename="general_server", device!="lo"}[1m]) +
rate(node_network_transmit_bytes_total{nodename="general_server", device!="lo"}[1m])
) / 1024 / 1024 > 10
for: 1m
annotations:
description: >-
{% raw %}general_server: суммарный трафик {{ printf "%.1f" $value }} МБ/с превысил порог 10 МБ/с{% endraw %}