From f62396b1d04d59e9423d32c331c0eb74af60995e Mon Sep 17 00:00:00 2001 From: Alex Frantz Date: Sun, 28 Dec 2025 16:58:18 -0500 Subject: [PATCH] copy prometheus config --- tasks/monitoring.yml | 24 ++++++++++++++---------- templates/monitoring/prometheus.yml.j2 | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 templates/monitoring/prometheus.yml.j2 diff --git a/tasks/monitoring.yml b/tasks/monitoring.yml index b84d1f8..1c783aa 100644 --- a/tasks/monitoring.yml +++ b/tasks/monitoring.yml @@ -1,4 +1,18 @@ --- +# copy configs for loki, promtail & prometheus +- name: Create Loki Configuration + template: + src: templates/monitoring/loki.yaml.j2 + dest: "{{ data_dir }}/monitoring/loki/loki-config.yaml" +- name: Create Promtail Configuration + template: + src: templates/monitoring/promtail.yaml.j2 + dest: "{{ data_dir }}/monitoring/promtail/promtail-config.yaml" +- name: Create Prometheus Configuration + template: + src: templates/monitoring/prometheus.yml.j2 + dest: "{{ data_dir }}/monitoring/prometheus/prometheus.yml" + - name: Deploy Prometheus include_role: name: docker @@ -27,16 +41,6 @@ traefik.http.routers.prom.tls.certresolver: letsencrypt traefik.http.services.prom.loadbalancer.server.port: "9090" -# copy configs for loki -- name: Create Loki Configuration - template: - src: templates/monitoring/loki.yaml.j2 - dest: "{{ data_dir }}/monitoring/loki/loki-config.yaml" -- name: Create Promtail Configuration - template: - src: templates/monitoring/promtail.yaml.j2 - dest: "{{ data_dir }}/monitoring/promtail/promtail-config.yaml" - - name: Deploy Promtail include_role: name: docker diff --git a/templates/monitoring/prometheus.yml.j2 b/templates/monitoring/prometheus.yml.j2 new file mode 100644 index 0000000..0d771be --- /dev/null +++ b/templates/monitoring/prometheus.yml.j2 @@ -0,0 +1,14 @@ +global: + scrape_interval: 15s + evaluation_interval: 15s + +scrape_configs: + - job_name: "prometheus" + static_configs: + - targets: ["monitoring_prometheus:9090"] + - job_name: "node-exporter" + static_configs: + - targets: ["172.16.0.25:9100"] + - job_name: "cadvisor" + static_configs: + - targets: ["monitoring_cadvisor:8080"] \ No newline at end of file