From a306f5ce19af1e3c8848e91eccf433e2bd5067a3 Mon Sep 17 00:00:00 2001 From: William Petit Date: Mon, 25 Jun 2018 11:02:58 +0200 Subject: [PATCH 1/2] Use system_mail_from when using SMTP system configuration --- tmpl/alertmanager.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tmpl/alertmanager.yml b/tmpl/alertmanager.yml index e72e74c..9e6917e 100644 --- a/tmpl/alertmanager.yml +++ b/tmpl/alertmanager.yml @@ -10,6 +10,7 @@ global: smtp_smarthost: '%%exim_relay_smtp:465' smtp_require_tls: true %end if + smtp_from: '%%system_mail_from' %else smtp_smarthost: '%%alSMTPHost:%%alSMTPPort' smtp_from: '%%alFrom' @@ -31,8 +32,8 @@ global: #hipchat_api_url: 'https://hipchat.foobar.org/' # The directory from which notification templates are read. -templates: -- '/etc/alertmanager/template/*.tmpl' +templates: + - '/etc/alertmanager/template/*.tmpl' # The root route on which each incoming alert enters. route: @@ -54,12 +55,12 @@ route: # If an alert has successfully been sent, wait 'repeat_interval' to # resend them. - repeat_interval: 3h + repeat_interval: 3h # A default receiver receiver: %%alDefaultReceiver - # All the above attributes are inherited by all child routes and can + # All the above attributes are inherited by all child routes and can # overwritten on each. # The child route trees. @@ -119,7 +120,7 @@ route: # Inhibition rules allow to mute a set of alerts given that another alert is # firing. -# We use this to mute any warning-level notifications if the same alert is +# We use this to mute any warning-level notifications if the same alert is # already critical. inhibit_rules: - source_match: From dc43a0f26c0c5b4101812ef496f00a09ae0ad2f7 Mon Sep 17 00:00:00 2001 From: William Petit Date: Mon, 25 Jun 2018 11:07:56 +0200 Subject: [PATCH 2/2] Add alerting prediction rules --- dicos/70_prometheus.xml | 7 ++++--- tmpl/predict-rules.yml | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tmpl/predict-rules.yml diff --git a/dicos/70_prometheus.xml b/dicos/70_prometheus.xml index d0044e0..ca108d3 100644 --- a/dicos/70_prometheus.xml +++ b/dicos/70_prometheus.xml @@ -1,10 +1,11 @@ - + - + + prometheus @@ -147,7 +148,7 @@ Services complèmentairse Configuration du serveur Prometheus - Configuration des jobs standards + Configuration des jobs standards Configuration SMTP pour l'envois des alertes Destinatires Rêgles de distribution simples diff --git a/tmpl/predict-rules.yml b/tmpl/predict-rules.yml new file mode 100644 index 0000000..958a587 --- /dev/null +++ b/tmpl/predict-rules.yml @@ -0,0 +1,6 @@ +groups: + - name: PredictRules + rules: + - alert: disk_full_within_6_hours + expr: predict_linear(node_filesystem_free{job="%%{job_name_node}",mountpoint="/"}[1h], 6 * 3600) < 0 + for: 5m \ No newline at end of file