[prometheus] Do not put :9100 in instance name

certbot_on_virtu
Alexandre Iooss 2019-10-13 10:43:45 +02:00
parent 14fc0bbf54
commit 46e2111368
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 16 additions and 7 deletions

View File

@ -4,12 +4,7 @@
vars: vars:
# Prometheus targets.json # Prometheus targets.json
prometheus_targets: prometheus_targets:
- labels: {job: node} - targets: "{{ groups['server'] | list | sort }}"
targets: |
{{ groups['server'] | map('replace', '.org', '.org:9100') |
list | sort }}
- labels: {job: prometheus}
targets: ['localhost:9090']
prometheus_ups_snmp_targets: prometheus_ups_snmp_targets:
- targets: [pulsar.adm.crans.org] - targets: [pulsar.adm.crans.org]
prometheus_unifi_snmp_targets: prometheus_unifi_snmp_targets:

View File

@ -27,10 +27,24 @@ rule_files:
scrape_configs: scrape_configs:
# The .json in file_sd_configs is dynamically reloaded # The .json in file_sd_configs is dynamically reloaded
- job_name: dummy - job_name: prometheus
static_configs:
- targets:
- localhost:9090
- job_name: servers
file_sd_configs: file_sd_configs:
- files: - files:
- '/etc/prometheus/targets.json' - '/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: instance
- source_labels: [__param_target]
target_label: __address__
replacement: '$1:9100'
- job_name: ups_snmp - job_name: ups_snmp
file_sd_configs: file_sd_configs: