From 6c24a67d504a92962050f12ee11a6496079c9b25 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Wed, 19 Jul 2023 23:46:05 +0100 Subject: [PATCH] Configurable internet speed test interval --- roles/stats/defaults/main.yml | 1 + roles/stats/templates/prometheus.yml.j2 | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/stats/defaults/main.yml b/roles/stats/defaults/main.yml index 3dc240df..48ad89ba 100644 --- a/roles/stats/defaults/main.yml +++ b/roles/stats/defaults/main.yml @@ -49,6 +49,7 @@ stats_grafana_memory: 1g stats_prometheus_retention_time: 365d stats_prometheus_retention_size: 30GB stats_collection_interval: 15s +stats_speedtest_collection_interval: 1h # uncomment to scrape more hosts # stats_prometheus_additional_hosts: diff --git a/roles/stats/templates/prometheus.yml.j2 b/roles/stats/templates/prometheus.yml.j2 index 34e5a0b4..5f7e46ad 100644 --- a/roles/stats/templates/prometheus.yml.j2 +++ b/roles/stats/templates/prometheus.yml.j2 @@ -35,13 +35,15 @@ scrape_configs: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:8083" ] +{% if stats_internet_speed_test_enabled %} - job_name: "speedtest" - scrape_interval: 1h + scrape_interval: {{ stats_speedtest_collection_interval }} scrape_timeout: 5m static_configs: - targets: [ "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ stats_speedtest_exporter_port }}" ] +{% endif %} {% if stats_prometheus_additional_hosts is defined %} - job_name: "additional_hosts"