From afdadedd5ccef655c540c638d596e024c4880893 Mon Sep 17 00:00:00 2001 From: F2256342 Daniel de Oliveira Carvalho Date: Tue, 12 Apr 2022 13:37:35 -0300 Subject: [PATCH] update --- .env | 2 +- alert.rules.yml | 11 +++++++++++ docker-compose.yml | 12 ++++++++++-- prometheus.yml | 14 ++++++++++++-- 4 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 alert.rules.yml diff --git a/.env b/.env index 2c231ae..232be79 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -KIZUMBA=WHATEVER \ No newline at end of file +TEST=localhost:9090 \ No newline at end of file diff --git a/alert.rules.yml b/alert.rules.yml new file mode 100644 index 0000000..1ac5521 --- /dev/null +++ b/alert.rules.yml @@ -0,0 +1,11 @@ +groups: +- name: alert.rules + rules: + - alert: InstanceDown + expr: up == 0 + for: 1m + labels: + severity: "critical" + annotations: + summary: "Endpoint {{ $labels.instance }} down" + description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes." diff --git a/docker-compose.yml b/docker-compose.yml index e3821d4..f2cbd14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,8 +18,13 @@ services: build: context: ../prometheus-data-generator/ network_mode: bridge + ports: + - "9000:9000" volumes: - - ../prometheus-data-generator/config.yml:/config.yml + # - ../prometheus-data-generator/config.yml:/config.yml + - /home/f2256342/forge/prometheus-data-generator/config.yml:/config.yml + command: --no-collector.rapl + prometheus: @@ -34,4 +39,7 @@ services: env_file: - ./.env volumes: - - /home/yutsuo/forge/monitor/prometheus.yml:/etc/prometheus/prometheus.yml \ No newline at end of file + # - /home/yutsuo/forge/monitor/prometheus.yml:/etc/prometheus/prometheus.yml + - /home/f2256342/forge/monitor/prometheus.yml:/etc/prometheus/prometheus.yml + # command: --enable-feature=expand-external-labels --config.file=/etc/prometheus/prometheus.yml + diff --git a/prometheus.yml b/prometheus.yml index a99ad17..f4c6347 100644 --- a/prometheus.yml +++ b/prometheus.yml @@ -3,6 +3,15 @@ global: external_labels: monitor: "codelab-monitor" +rule_files: + - alert.rules.yml + +alerting: + alertmanagers: + - static_configs: + - targets: + - "localhost:9093" + scrape_configs: - job_name: "cfe-acesso" scheme: "https" @@ -14,9 +23,10 @@ scrape_configs: - job_name: "node-exporter" scrape_interval: 5s static_configs: - - targets: ["node-exporter:9100"] + - targets: ["localhost:9100"] - job_name: "prometheus" + relabel_configs: scrape_interval: 5s static_configs: - targets: ["localhost:9090"] @@ -24,4 +34,4 @@ scrape_configs: - job_name: "data-exporter" scrape_interval: 5s static_configs: - - targets: ["data-exporter:9000"] \ No newline at end of file + - targets: ["localhost:9000"]