Merge "Alerts reworked"
diff --git a/ntp/map.jinja b/ntp/map.jinja
index 3f4d703..bb62c04 100644
--- a/ntp/map.jinja
+++ b/ntp/map.jinja
@@ -32,4 +32,11 @@
'address': '0.0.0.0',
}
},
-}, merge=salt['pillar.get']('ntp:server')) %}
\ No newline at end of file
+}, merge=salt['pillar.get']('ntp:server')) %}
+
+{%- set monitoring = salt['grains.filter_by']({
+ 'default': {
+ 'ntp_offset_threshold': 200,
+ },
+}, grain='os_family', merge=salt['pillar.get']('ntp:monitoring')) %}
+
diff --git a/ntp/meta/prometheus.yml b/ntp/meta/prometheus.yml
index 0428dab..5c632cf 100644
--- a/ntp/meta/prometheus.yml
+++ b/ntp/meta/prometheus.yml
@@ -1,17 +1,18 @@
-{%- from "ntp/map.jinja" import client with context %}
+{%- from "ntp/map.jinja" import client, monitoring with context %}
{%- if client.get('enabled', False) %}
-{%- raw %}
server:
alert:
- NtpOffset:
+ NtpOffsetTooHigh:
+ {%- set threshold = monitoring.ntp_offset_threshold %}
if: >-
- ntpq_offset >= 250
+ ntpq_offset >= {{ threshold }}
+ for: 2m
labels:
severity: warning
service: ntp
annotations:
- summary: 'NTP offset is too high'
- description: 'NTP offset is higher than 250ms on node {{ $labels.host }}'
+ summary: "NTP offset reached the limit of {{ threshold }}ms{%- raw %}"
+ description: "The NTP offset on the {{ $labels.host }} node is {{ $value }}ms for at least 2 minutes."
{%- endraw %}
-{%- endif %}
\ No newline at end of file
+{%- endif %}