From e3a6295709830549a900f9b83520e2c3f9e40311 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 6 Jun 2018 15:14:07 +0200 Subject: [PATCH 1/3] Using 127.0.0.1 ... --- dicos/70_prometheus.xml | 26 +++++++++++++------------- postservice/88_grafana | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dicos/70_prometheus.xml b/dicos/70_prometheus.xml index 5f0dbd3..91e80d1 100644 --- a/dicos/70_prometheus.xml +++ b/dicos/70_prometheus.xml @@ -69,20 +69,20 @@ - localhost + localhost - - 86400 - - - admin - - - false - - - false - + + 86400 + + + admin + + + false + + + false + diff --git a/postservice/88_grafana b/postservice/88_grafana index 3459bcd..fcac009 100755 --- a/postservice/88_grafana +++ b/postservice/88_grafana @@ -73,7 +73,7 @@ _EOF_ # rm -rf ${tmpFile} } -grafanaHost=$(CreoleGet srvGrafanaIP 192.168.30.57) +grafanaHost=$(CreoleGet srvGrafanaIP 127.0.0.1) grafanaPort=$(CreoleGet srvGrafanaPort 3000) grafanaUser="admin" grafanaPasswd=$(CreoleGet grafana_admin_passwd admin) From ab479fd33a68960ebee3393955fadaf31c408373 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 6 Jun 2018 16:00:36 +0200 Subject: [PATCH 2/3] 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: From e95d6f9e1d6db9b03843354ad977495fb8dd059f Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 6 Jun 2018 16:09:57 +0200 Subject: [PATCH 3/3] Improving dico to be more Prometheus like We need to be closer to the prometheus way to do things --- dicos/70_prometheus.xml | 37 +++++++++++++++++++++---------------- tmpl/prometheus.yml | 16 +++++++--------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/dicos/70_prometheus.xml b/dicos/70_prometheus.xml index b511d1b..4fda90d 100644 --- a/dicos/70_prometheus.xml +++ b/dicos/70_prometheus.xml @@ -47,9 +47,19 @@ /etc/prometheus/nodes + + non + + + + + + + Node Exporter + - + oui @@ -63,19 +73,7 @@ http - - non - - - - - - - - Node Exporter - - - + non @@ -141,6 +139,7 @@ Services complèmentairse Configuration du serveur Prometheus + Configuration des jobs standards Configuration SMTP pour l'envois des alertes Destinatires Rêgles de distribution simples @@ -155,6 +154,13 @@ alReceiverEmail + + scrpInterval + scrpTimeout + honorLabels + scrpScheme + + alRouteMatchSource alRouteMatchValue @@ -175,7 +181,6 @@ prTargIP - prTargJob prTargSonde @@ -186,7 +191,7 @@ - ['Node Exporter','Port'] + ['Node Exporter'] diff --git a/tmpl/prometheus.yml b/tmpl/prometheus.yml index ba8a6a2..edefb87 100644 --- a/tmpl/prometheus.yml +++ b/tmpl/prometheus.yml @@ -26,25 +26,23 @@ scrape_configs: %if %%getVar('addTargetPrometheus','non') == 'oui' static_configs: - targets: [ "%%adresse_ip_eth0:9100"%slurp - %if %%getVar('ajout_client_prometheus','non') == 'oui' - %for %%cliPr in %%getVar('prCli',[]) - %if %%cliPr.prCliSonde == 'Node Exporter' -, '%%cliPr.prCliIP:9100'%slurp + %for %%cliPr in %%getVar('prTarg',[]) + %if %%cliPr.prTargSonde == 'Node Exporter' +, '%%cliPr.prTargIP:9100'%slurp %end if %end for - %end if ] %end if -%for %%job in %%getVar['promJobs',[]] +%for %%job in %%getVar('promJobs', []) - job_name: '%%job' %if %%job.honorLabels == 'oui' honor_labels: true %else - honor_labels; false + honor_labels: false %end if - scrape_interval: %%job.scrpInterval - scrape_timeout: %%job.scrpTimeout + scrape_interval: %%{job.scrpInterval}s + scrape_timeout: %%{job.scrpTimeout}s scheme: %%job.scrpScheme %for %%target in %%getVar('prOpenTarg',[]) static_configs: