ansible/roles/prometheus/templates/prometheus.yml.j2

180 lines
5.3 KiB
Text
Raw Normal View History

2021-04-01 05:21:08 +02:00
---
{{ ansible_managed | comment }}
2019-05-05 14:07:04 +02:00
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:
federated_instance: '{{ inventory_hostname }}'
2019-05-05 14:07:04 +02:00
# Alertmanager configuration
2019-11-01 14:16:32 +01:00
# Use prometheus alertmanager installed on the same machine
2019-05-05 14:07:04 +02:00
alerting:
alertmanagers:
- static_configs:
2019-11-01 15:38:35 +01:00
- targets: ['{{ prometheus_alertmanager }}']
2019-05-05 14:07:04 +02:00
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
2021-04-11 15:58:35 +02:00
- "alerts/*.yml" # Monitoring alerts, this is the file you may be searching!
2019-05-05 14:07:04 +02:00
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
2019-11-01 14:16:32 +01:00
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
2021-12-31 15:08:44 +01:00
{% if prometheus_servers_targets is defined %}
2019-11-01 14:16:32 +01:00
- job_name: servers
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_servers_targets | to_json }}
2019-11-01 14:16:32 +01:00
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'
2021-12-31 15:08:44 +01:00
{% endif %}
2019-11-01 14:16:32 +01:00
2021-12-31 15:08:44 +01:00
{% if prometheus_unifi_snmp_targets is defined %}
2019-11-01 14:16:32 +01:00
- job_name: unifi_snmp
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_unifi_snmp_targets | to_json }}
2019-11-01 14:16:32 +01:00
metrics_path: /snmp
params:
module: [ubiquiti_unifi]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9116
2021-12-31 15:08:44 +01:00
{% endif %}
2019-11-01 14:16:32 +01:00
2021-12-31 15:08:44 +01:00
{% if prometheus_ups_snmp_targets is defined %}
- job_name: ups_snmp
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_ups_snmp_targets | to_json }}
metrics_path: /snmp
params:
module: [eatonups]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9116
2021-12-31 15:08:44 +01:00
{% endif %}
2021-12-31 15:08:44 +01:00
{% if prometheus_switch_snmp_targets is defined %}
2021-03-06 01:57:32 +01:00
- job_name: switch_snmp
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_switch_snmp_targets | to_json }}
2021-03-06 01:57:32 +01:00
metrics_path: /snmp
params:
module: [procurve_switch]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9116
2021-12-31 15:08:44 +01:00
{% endif %}
2021-03-06 01:57:32 +01:00
2021-12-31 15:08:44 +01:00
{% if prometheus_docker_targets is defined %}
2021-02-10 19:06:28 +01:00
- job_name: docker
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_docker_targets | to_json }}
relabel_configs:
# Do not put :8087 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:8087'
2021-12-31 15:08:44 +01:00
{% endif %}
2021-12-31 15:08:44 +01:00
{% if prometheus_postgresql_targets is defined %}
- job_name: postgresql
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_postgresql_targets | to_json }}
relabel_configs:
# Do not put :9187 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:9187'
2021-12-31 15:08:44 +01:00
{% endif %}
2021-08-20 16:58:28 +02:00
2021-12-31 15:08:44 +01:00
{% if prometheus_apc_pdu_snmp_targets is defined %}
2021-08-20 16:58:28 +02:00
- job_name: apc_pdu_snmp
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_apc_pdu_snmp_targets | to_json }}
2021-08-20 16:58:28 +02:00
metrics_path: /snmp
params:
module:
- apc_pdu
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9116
2021-12-31 15:08:44 +01:00
{% endif %}
2021-08-20 16:58:28 +02:00
2021-12-31 15:08:44 +01:00
{% if prometheus_ipmi_targets is defined %}
2021-12-31 14:45:05 +01:00
- job_name: ipmi
2021-12-31 15:08:44 +01:00
static_configs:
- targets: {{ prometheus_ipmi_targets | to_json }}
2021-12-31 14:45:05 +01:00
metrics_path: /metrics
params:
module: [default]
relabel_configs:
# Do not put :9290 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:9290'
2021-12-31 15:08:44 +01:00
{% endif %}
2021-12-31 14:45:05 +01:00
{% if prometheus_ilo_snmp_targets is defined %}
- job_name: ilo_snmp
2021-12-31 18:31:58 +01:00
static_configs:
- targets: {{ prometheus_ilo_snmp_targets | to_json }}
2021-12-31 18:31:58 +01:00
metrics_path: /snmp
scrape_timeout: 30s
2021-12-31 18:31:58 +01:00
params:
module:
- ilo
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9116
{% endif %}
2021-04-01 05:21:08 +02:00
...