From ab479fd33a68960ebee3393955fadaf31c408373 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 6 Jun 2018 16:00:36 +0200 Subject: [PATCH] Improve configuration flexibility to match prometheus way of doing things --- dicos/70_prometheus.xml | 200 ++++++++++++++++++++++------------------ tmpl/prometheus.yml | 29 ++++-- 2 files changed, 133 insertions(+), 96 deletions(-) diff --git a/dicos/70_prometheus.xml b/dicos/70_prometheus.xml index 91e80d1..b511d1b 100644 --- a/dicos/70_prometheus.xml +++ b/dicos/70_prometheus.xml @@ -2,7 +2,7 @@ - + prometheus @@ -18,20 +18,20 @@ - - oui + + oui - + - - oui - - - oui - - + + oui + + + oui + + prometheus - + 15s @@ -41,88 +41,106 @@ 10s - - node - - + + node + + /etc/prometheus/nodes - - + + + + oui + + + 15 + + + 10 + + + http + + + non - - - - + + + + + + Node Exporter - + non - - - - + + + + + - - - localhost - - - 86400 - - - admin - - - false - - - false - - - - - - - - non - - - non - - - + + + localhost + + + 86400 + + + admin + + + false + + + false + + + + + + + + + non + + + non + + + - - + + - + - - - - + + + + - - - - + + + + - - - - + + + + - Services complèmentairse - Configuration du serveur Prometheus + Services complèmentairse + Configuration du serveur Prometheus Configuration SMTP pour l'envois des alertes Destinatires Rêgles de distribution simples @@ -155,20 +173,26 @@ alSubRouteMatchReceiver - - prCliIP - prCliSonde + + prTargIP + prTargJob + prTargSonde - - prOpenCliIP - prOpenCliPort + + prOpenTargIP + prOpenTargPort + prOpenTargJob - + ['Node Exporter','Port'] + + ['http','https'] + + ['','service','severity'] @@ -208,17 +232,17 @@ alertmanager - + non - prCli - prCliIP - prCliSonde + prTarg + prTargIP + prTargSonde - + non - prOpenCli - prOpenCliIP - prOpenCliPort + prOpenTarg + prOpenTargIP + prOpenTargPort diff --git a/tmpl/prometheus.yml b/tmpl/prometheus.yml index cea07be..ba8a6a2 100644 --- a/tmpl/prometheus.yml +++ b/tmpl/prometheus.yml @@ -18,12 +18,12 @@ scrape_configs: %end if ] + + - job_name: '%%job_name_node' file_sd_configs: - files: [ "%%job_file_config/*.yml" ] -%if %%is_empty('ajout_client_prometheus') or %%is_empty('addPrOpenCli') -# Nothing to configure -%else +%if %%getVar('addTargetPrometheus','non') == 'oui' static_configs: - targets: [ "%%adresse_ip_eth0:9100"%slurp %if %%getVar('ajout_client_prometheus','non') == 'oui' @@ -33,14 +33,27 @@ scrape_configs: %end if %end for %end if - %if %%getVar('addPrOpenCli','non') == 'oui' - %for %%cliOpen in %%getVar('prOpenCli',[]) -, '%%cliOpen.prOpenCliIP:%%cliOpen.prOpenCliPort'%slurp - %end for - %end if ] %end if +%for %%job in %%getVar['promJobs',[]] + - job_name: '%%job' + %if %%job.honorLabels == 'oui' + honor_labels: true + %else + honor_labels; false + %end if + scrape_interval: %%job.scrpInterval + scrape_timeout: %%job.scrpTimeout + scheme: %%job.scrpScheme + %for %%target in %%getVar('prOpenTarg',[]) + static_configs: + %if %%target.prOpenTargJob == %%job + - targets: [ "%%target.prOpenTargIP:%%target.prOpenTargPort" ] + %end if + %end for +%end for + %if %%getVar('activerAlertmanager','non') == 'oui' alerting: alertmanagers: