Use label federated_instance instead of instance #28

Merged
jeltz merged 13 commits from fix_exported_prometheus into master 2021-03-06 02:09:25 +01:00
Showing only changes of commit 52124d2cad - Show all commits

View file

@ -1,51 +1,35 @@
# {{ ansible_managed }} ---
{{ ansible_managed | comment }}
global: 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: external_labels:
monitor: 'example' monitor: '{{ ansible_fqdn }}'
# Alertmanager configuration
# Use prometheus alertmanager installed on the same machine
alerting: alerting:
alertmanagers: alertmanagers:
- static_configs: - static_configs:
- targets: ['{{ prometheus_alertmanager }}'] - targets: ['{{ prometheus_alertmanager }}']
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files: rule_files:
- "alert.rules.yml" # Monitoring alerts, this is the file you may be searching! - 'alert.rules.yml'
- "django.rules.yml" # Custom rules specific for Django project monitoring
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs: scrape_configs:
# The .json in file_sd_configs is dynamically reloaded
- job_name: federate - job_name: federate
scrape_interval: 15s scrape_interval: 30s
metrics_path: '/federate' metrics_path: '/federate'
honor_labels: true honor_labels: true
honor_timestamps: true
file_sd_configs: file_sd_configs:
- files: - files:
- '/etc/prometheus/targets.json' - '/etc/prometheus/targets.json'
relabel_configs: relabel_configs:
# Do not put :9100 in instance name, rather here
- source_labels: [__address__] - source_labels: [__address__]
target_label: __param_target target_label: __param_target
- source_labels: [__param_target]
target_label: federated_instance
- source_labels: [__param_target] - source_labels: [__param_target]
target_label: __address__ target_label: __address__
replacement: '$1:9090' replacement: '$1:9090'
params: params:
'match[]': match[]:
- '{job="servers"}' - '{job="servers"}'
- '{job="prometheus"}' - '{job="prometheus"}'
- '{job="unifi_snmp"}' - '{job="unifi_snmp"}'
@ -54,4 +38,4 @@ scrape_configs:
- '{job="django"}' - '{job="django"}'
- '{job="docker"}' - '{job="docker"}'
- '{job="switch"}' - '{job="switch"}'
...