diff --git a/roles/prometheus_federate/templates/prometheus/prometheus.yml.j2 b/roles/prometheus_federate/templates/prometheus/prometheus.yml.j2 index ee7f4a6..5d9a31a 100644 --- a/roles/prometheus_federate/templates/prometheus/prometheus.yml.j2 +++ b/roles/prometheus_federate/templates/prometheus/prometheus.yml.j2 @@ -1,51 +1,35 @@ -# {{ ansible_managed }} +--- +{{ ansible_managed | comment }} global: - # scrape_interval is set to the global default (60s) - # evaluation_interval is set to the global default (60s) - # scrape_timeout is set to the global default (10s). - - # Attach these labels to any time series or alerts when communicating with - # external systems (federation, remote storage, Alertmanager). external_labels: - monitor: 'example' + monitor: '{{ ansible_fqdn }}' -# Alertmanager configuration -# Use prometheus alertmanager installed on the same machine alerting: alertmanagers: - - static_configs: - - targets: ['{{ prometheus_alertmanager }}'] + - static_configs: + - targets: ['{{ prometheus_alertmanager }}'] -# Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: - - "alert.rules.yml" # Monitoring alerts, this is the file you may be searching! - - "django.rules.yml" # Custom rules specific for Django project monitoring + - 'alert.rules.yml' -# A scrape configuration containing exactly one endpoint to scrape: -# Here it's Prometheus itself. scrape_configs: - # The .json in file_sd_configs is dynamically reloaded - - - job_name: federate - scrape_interval: 15s + scrape_interval: 30s metrics_path: '/federate' honor_labels: true + honor_timestamps: true file_sd_configs: - files: - '/etc/prometheus/targets.json' relabel_configs: - # Do not put :9100 in instance name, rather here - source_labels: [__address__] target_label: __param_target - - source_labels: [__param_target] - target_label: federated_instance - source_labels: [__param_target] target_label: __address__ replacement: '$1:9090' params: - 'match[]': + match[]: - '{job="servers"}' - '{job="prometheus"}' - '{job="unifi_snmp"}' @@ -54,4 +38,4 @@ scrape_configs: - '{job="django"}' - '{job="docker"}' - '{job="switch"}' - +...