diff --git a/dicos/70_prometheus.xml b/dicos/70_prometheus.xml index d0044e0..e5a3352 100644 --- a/dicos/70_prometheus.xml +++ b/dicos/70_prometheus.xml @@ -1,10 +1,11 @@ - + - + + prometheus @@ -104,6 +105,7 @@ false + @@ -147,7 +149,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/alertmanager.yml b/tmpl/alertmanager.yml index e72e74c..10332c5 100644 --- a/tmpl/alertmanager.yml +++ b/tmpl/alertmanager.yml @@ -4,12 +4,13 @@ global: %if %%tls_smtp == "non" smtp_smarthost: '%%exim_relay_smtp:25' %elif %%tls_smtp == "port 25" - smtp_smarthost: '%%exim_relay_smtp:25' - smtp_require_tls: true - %else - smtp_smarthost: '%%exim_relay_smtp:465' - smtp_require_tls: true + smtp_smarthost: '%%exim_relay_smtp:25' + smtp_require_tls: true + %else + 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: diff --git a/tmpl/grafana.ini b/tmpl/grafana.ini index ba811af..341b329 100644 --- a/tmpl/grafana.ini +++ b/tmpl/grafana.ini @@ -40,11 +40,13 @@ domain = %%grafana_domain # Redirect to correct domain if host header does not match domain # Prevents DNS rebinding attacks -;enforce_domain = false +enforce_domain = true # The full public facing url you use in browser, used for redirects and emails # If you use reverse proxy and sub path specify full url (with sub path) -;root_url = http://localhost:3000 +%if %%is_empty('grafanaRootURL') +root_url = %%grafanaRootURL +%end if # Log web requests ;router_logging = false @@ -299,18 +301,20 @@ enabled = %%grafana_auth_anonymous #################################### SMTP / Emailing ########################## [smtp] -;enabled = false -;host = localhost:25 +%if %%getVar('activer_exim_relay_smtp','non') == 'oui' +enabled = true +host = %%exim_relay_smtp:25 ;user = # If the password contains # or ; you have to wrap it with trippel quotes. Ex """#password;""" ;password = ;cert_file = ;key_file = -;skip_verify = false -;from_address = admin@grafana.localhost -;from_name = Grafana +skip_verify = true +from_address = %%system_mail_from +from_name = Grafana # EHLO identity in SMTP dialog (defaults to instance_name) ;ehlo_identity = dashboard.example.com +%end if [emails] ;welcome_email_on_sign_up = false 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 diff --git a/tmpl/prometheus.yml b/tmpl/prometheus.yml index 87a0b79..f305d20 100644 --- a/tmpl/prometheus.yml +++ b/tmpl/prometheus.yml @@ -22,7 +22,7 @@ scrape_configs: - job_name: '%%job_name_node' file_sd_configs: - - files: [ "%%job_file_config/*.yml" ] +# - files: [ "%%job_file_config/*.yml" ] %if %%getVar('addTargetPrometheus','non') == 'oui' static_configs: - targets: [ "%%adresse_ip_eth0:9100"%slurp