2021-02-10 20:42:37 +01:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
{# As this is also Jinja2 it will conflict without a raw block #}
|
|
|
|
{# Depending of Prometheus Node exporter version, rules can change depending of version #}
|
|
|
|
{% raw %}
|
|
|
|
groups:
|
|
|
|
- name: alert.rules
|
|
|
|
rules:
|
|
|
|
|
|
|
|
# Alert for any instance that is unreachable for >3 minutes.
|
|
|
|
- alert: InstanceDown
|
|
|
|
expr: up == 0
|
|
|
|
for: 3m
|
|
|
|
labels:
|
|
|
|
severity: critical
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : {{ $labels.exported_instance }} est invisible depuis plus de 3 minutes !"
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
# Alert for out of memory
|
|
|
|
- alert: OutOfMemory
|
|
|
|
expr: (node_memory_MemFree_bytes + node_memory_Cached_bytes + node_memory_Buffers_bytes) / node_memory_MemTotal_bytes * 100 < 10
|
|
|
|
for: 5m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : Mémoire libre de {{ $labels.exported_instance }} à {{ humanize $value }}%."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
# Alert for out of disk space
|
|
|
|
- alert: OutOfDiskSpace
|
|
|
|
expr: node_filesystem_free_bytes{fstype="ext4"} / node_filesystem_size_bytes{fstype="ext4"} * 100 < 10
|
|
|
|
for: 5m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Espace libre de {{ $labels.mountpoint }} sur {{ $labels.exported_instance }} à {{ humanize $value }}%."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
# Alert for out of inode space on disk
|
|
|
|
- alert: OutOfInodes
|
|
|
|
expr: node_filesystem_files_free{fstype="ext4"} / node_filesystem_files{fstype="ext4"} * 100 < 10
|
|
|
|
for: 5m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : Presque plus d'inodes disponibles ({{ $value }}% restant) dans {{ $labels.mountpoint }} sur {{ $labels.exported_instance }}."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
# Alert for high CPU usage
|
|
|
|
- alert: CpuUsage
|
|
|
|
expr: (100 - avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 75
|
|
|
|
for: 10m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : CPU sur {{ $labels.exported_instance }} à {{ humanize $value }}%."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
# Check systemd unit (> buster)
|
|
|
|
- alert: SystemdServiceFailed
|
|
|
|
expr: node_systemd_unit_state{state="failed"} == 1
|
|
|
|
for: 10m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : {{ $labels.name }} a échoué sur {{ $labels.exported_instance }}"
|
|
|
|
|
2021-02-10 20:42:37 +01:00
|
|
|
# Check UPS
|
|
|
|
- alert: UpsOutputSourceChanged
|
|
|
|
expr: upsOutputSource != 3
|
|
|
|
for: 1m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : La source d'alimentation de {{ $labels.exported_instance }} a changé !"
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
- alert: UpsBatteryStatusWarning
|
|
|
|
expr: upsBatteryStatus == 3
|
|
|
|
for: 2m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : L'état de la batterie de {{ $labels.exported_instance }} est faible !"
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
- alert: UpsBatteryStatusCritical
|
|
|
|
expr: upsBatteryStatus == 4
|
|
|
|
for: 10m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "L'état de la batterie de {{ $labels.exported_instance }} est affaibli !"
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
- alert: UpsHighLoad
|
|
|
|
expr: upsOutputPercentLoad > 70
|
|
|
|
for: 5m
|
|
|
|
labels:
|
|
|
|
severity: critical
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : La charge de {{ $labels.exported_instance }} est de {{ $value }}% !"
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
- alert: UpsWrongInputVoltage
|
|
|
|
expr: (upsInputVoltage < 210) or (upsInputVoltage > 250)
|
|
|
|
for: 10m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : La tension d'entrée de {{ $labels.exported_instance }} est de {{ $value }}V."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
- alert: UpsWrongOutputVoltage
|
|
|
|
expr: (upsOutputVoltage < 220) or (upsOutputVoltage > 240)
|
|
|
|
for: 10m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : La tension de sortie de {{ $labels.exported_instance }} est de {{ $value }}V."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
- alert: UpsTimeRemainingWarning
|
|
|
|
expr: upsEstimatedMinutesRemaining < 15
|
|
|
|
for: 1m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : L'autonomie restante sur {{ $labels.exported_instance }} est de {{ $value }} min."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
- alert: UpsTimeRemainingCritical
|
|
|
|
expr: upsEstimatedMinutesRemaining < 5
|
|
|
|
for: 1m
|
|
|
|
labels:
|
|
|
|
severity: critical
|
|
|
|
annotations:
|
2021-02-17 17:42:24 +01:00
|
|
|
summary: "Federate : L'autonomie restante sur {{ $labels.exported_instance }} est de {{ $value }} min."
|
2021-02-10 20:42:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
{% endraw %}
|