2021-05-25 18:25:22 +02:00
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
|
|
|
|
global:
|
2021-09-30 12:25:21 +02:00
|
|
|
|
scrape_interval: {{ prometheus_server_global_scrape_interval }}s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
|
|
|
|
evaluation_interval: {{ prometheus_server_global_evaluation_interval }}s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
2021-05-25 18:25:22 +02:00
|
|
|
|
|
|
|
|
|
# Attach these labels to any time series or alerts when communicating with
|
|
|
|
|
# external systems (federation, remote storage, Alertmanager).
|
|
|
|
|
external_labels:
|
|
|
|
|
monitor: '{{ prometheus_server_monitor }}'
|
|
|
|
|
|
|
|
|
|
{% if prometheus_server_rules is defined %}
|
|
|
|
|
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
|
|
|
|
rule_files:
|
|
|
|
|
- 'rules.yml'
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
# A scrape configuration containing exactly one endpoint to scrape:
|
|
|
|
|
# Here it's Prometheus itself.
|
|
|
|
|
scrape_configs:
|
|
|
|
|
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
2021-09-30 12:25:21 +02:00
|
|
|
|
- job_name: '{{ prometheus_server_job_name }}'
|
2021-05-25 18:25:22 +02:00
|
|
|
|
|
|
|
|
|
# Override the global default and scrape targets from this job every 5 seconds.
|
2021-09-30 12:25:21 +02:00
|
|
|
|
scrape_interval: {{ prometheus_server_scrape_interval }}s
|
|
|
|
|
scrape_timeout: {{ prometheus_server_scrape_timeout }}s
|
2021-05-25 18:25:22 +02:00
|
|
|
|
|
|
|
|
|
# metrics_path defaults to '/metrics'
|
|
|
|
|
# scheme defaults to 'http'.
|
|
|
|
|
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets: ['localhost:9090']
|
|
|
|
|
|
2021-05-26 17:34:59 +02:00
|
|
|
|
{% if prometheus_node_exporter_targets is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
# node exporter #
|
2021-05-25 18:25:22 +02:00
|
|
|
|
- job_name: node
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_node_exporter_targets %}
|
|
|
|
|
- {{ target }}:9100
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
2021-05-26 17:34:59 +02:00
|
|
|
|
{% if prometheus_mysqld_exporter_targets is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
# mysql exporter #
|
2021-05-25 18:25:22 +02:00
|
|
|
|
- job_name: mysql
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
2021-10-29 17:40:18 +02:00
|
|
|
|
{% if prometheus_mysqld_exporter_custom is defined %}
|
|
|
|
|
{% for target in prometheus_mysqld_exporter_custom.values() %}
|
|
|
|
|
- targets: ['{{ target.node_name }}:9104']
|
|
|
|
|
labels:
|
|
|
|
|
environment: '{{ target.environment }}'
|
|
|
|
|
node_name: '{{ target.node_name }}'
|
|
|
|
|
service_name: '{{ target.service_name }}'
|
|
|
|
|
cluster: '{{ target.cluster }}'
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% else %}
|
2021-05-25 18:25:22 +02:00
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_mysqld_exporter_targets %}
|
|
|
|
|
- {{ target }}:9104
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-10-29 17:40:18 +02:00
|
|
|
|
{% endif %}
|
2021-05-25 18:25:22 +02:00
|
|
|
|
|
2021-05-26 17:34:59 +02:00
|
|
|
|
{% if prometheus_mongodb_exporter_targets is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
# mongoDB exporter #
|
2021-05-25 18:25:22 +02:00
|
|
|
|
- job_name: mongodb
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
2021-10-12 15:46:38 +02:00
|
|
|
|
{% if prometheus_mongodb_exporter_custom is defined %}
|
|
|
|
|
{% for target in prometheus_mongodb_exporter_custom.values() %}
|
|
|
|
|
- targets: ['{{ target.node_name }}:9216']
|
|
|
|
|
labels:
|
|
|
|
|
environment: '{{ target.environment }}'
|
|
|
|
|
node_name: '{{ target.node_name }}'
|
|
|
|
|
service_name: '{{ target.service_name }}'
|
|
|
|
|
cluster: '{{ target.cluster }}'
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% else %}
|
2021-05-26 17:34:59 +02:00
|
|
|
|
- targets:
|
2021-05-25 18:25:22 +02:00
|
|
|
|
{% for target in prometheus_mongodb_exporter_targets %}
|
2021-05-31 12:18:34 +02:00
|
|
|
|
- {{ target }}:9216
|
2021-05-25 18:25:22 +02:00
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-10-12 15:46:38 +02:00
|
|
|
|
{% endif %}
|
2021-05-25 18:25:22 +02:00
|
|
|
|
|
2021-05-26 17:34:59 +02:00
|
|
|
|
{% if prometheus_postgres_exporter_targets is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
# postgresql exporter #
|
2021-05-25 18:25:22 +02:00
|
|
|
|
- job_name: postgresql
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
2021-10-29 18:16:32 +02:00
|
|
|
|
{% if prometheus_postgres_exporter_custom is defined %}
|
|
|
|
|
{% for target in prometheus_postgres_exporter_custom.values() %}
|
|
|
|
|
- targets: ['{{ target.node_name }}:9187']
|
|
|
|
|
labels:
|
|
|
|
|
environment: '{{ target.environment }}'
|
|
|
|
|
node_name: '{{ target.node_name }}'
|
|
|
|
|
service_name: '{{ target.service_name }}'
|
|
|
|
|
cluster: '{{ target.cluster }}'
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% else %}
|
2021-05-25 18:25:22 +02:00
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_postgres_exporter_targets %}
|
|
|
|
|
- {{ target }}:9187
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-10-29 18:16:32 +02:00
|
|
|
|
{% endif %}
|
2021-10-05 16:52:47 +02:00
|
|
|
|
|
|
|
|
|
{% if prometheus_phpfpm_exporter_targets is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
# PHP-FPM exporter #
|
2021-10-05 16:52:47 +02:00
|
|
|
|
- job_name: phpfpm
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_phpfpm_exporter_targets %}
|
|
|
|
|
- {{ target }}:9253
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-10-08 10:57:40 +02:00
|
|
|
|
|
2022-01-05 15:44:39 +01:00
|
|
|
|
{% if prometheus_php-opcache_exporter_targets is defined %}
|
|
|
|
|
# PHP-FPM exporter #
|
|
|
|
|
- job_name: php-opcache
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_php-opcache_exporter_targets %}
|
|
|
|
|
- {{ target }}:9101
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
2021-10-08 10:57:40 +02:00
|
|
|
|
{% if prometheus_apache_exporter_targets is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
# apache exporter #
|
2021-10-08 10:57:40 +02:00
|
|
|
|
- job_name: apache
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_apache_exporter_targets %}
|
|
|
|
|
- {{ target }}:9117
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-10-08 14:40:13 +02:00
|
|
|
|
|
|
|
|
|
{% if prometheus_haproxy_exporter_targets is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
# haproxy exporter #
|
2021-10-08 14:40:13 +02:00
|
|
|
|
- job_name: haproxy
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_haproxy_exporter_targets %}
|
|
|
|
|
- {{ target }}:8404
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-10-08 15:22:59 +02:00
|
|
|
|
|
|
|
|
|
{% if prometheus_varnish_exporter_targets is defined %}
|
2021-11-19 12:30:22 +01:00
|
|
|
|
# Varnish exporter #
|
2021-10-08 15:22:59 +02:00
|
|
|
|
- job_name: varnish
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_varnish_exporter_targets %}
|
|
|
|
|
- {{ target }}:9131
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
|
2021-11-02 15:55:14 +01:00
|
|
|
|
{% if prometheus_blackbox_exporter is defined %}
|
2021-11-15 18:04:43 +01:00
|
|
|
|
# blackbox #
|
2021-11-02 16:11:54 +01:00
|
|
|
|
{% if prometheus_blackbox_exporter_http is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
## http check ##
|
2021-11-15 18:04:43 +01:00
|
|
|
|
- job_name: blackbox - url
|
2021-11-02 15:51:47 +01:00
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
2021-11-15 18:04:43 +01:00
|
|
|
|
metrics_path: /probe
|
2021-11-02 15:51:47 +01:00
|
|
|
|
params:
|
|
|
|
|
module: [http_2xx]
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
2021-11-15 18:04:43 +01:00
|
|
|
|
{% for target in prometheus_blackbox_exporter_http %}
|
|
|
|
|
- {{target }}
|
|
|
|
|
{% endfor %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
relabel_configs:
|
|
|
|
|
- source_labels: [__address__]
|
|
|
|
|
target_label: __param_target
|
|
|
|
|
- source_labels: [__param_target]
|
|
|
|
|
target_label: instance
|
|
|
|
|
- target_label: __address__
|
2021-11-15 18:04:43 +01:00
|
|
|
|
replacement: {{ prometheus_blackbox_exporter_host }}:9115
|
2021-11-02 16:11:54 +01:00
|
|
|
|
{% endif %}
|
|
|
|
|
{% if prometheus_blackbox_exporter_ping is defined %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
## ping ##
|
2021-11-15 18:04:43 +01:00
|
|
|
|
- job_name: blackbox - ping
|
2021-11-02 15:51:47 +01:00
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
params:
|
|
|
|
|
module: [icmp]
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
2021-11-15 18:04:43 +01:00
|
|
|
|
{% for target in prometheus_blackbox_exporter_ping %}
|
|
|
|
|
- {{ target }}
|
|
|
|
|
{% endfor %}
|
2021-11-02 15:51:47 +01:00
|
|
|
|
relabel_configs:
|
|
|
|
|
- source_labels: [__address__]
|
|
|
|
|
target_label: __param_target
|
|
|
|
|
- source_labels: [__param_target]
|
|
|
|
|
target_label: instance
|
|
|
|
|
- target_label: __address__
|
2021-11-15 18:04:43 +01:00
|
|
|
|
replacement: {{ prometheus_blackbox_exporter_host }}:9115
|
2021-11-02 15:51:47 +01:00
|
|
|
|
{% endif %}
|
2021-11-02 16:11:54 +01:00
|
|
|
|
{% endif %}
|
2021-11-15 18:04:43 +01:00
|
|
|
|
|
2021-12-23 16:27:09 +01:00
|
|
|
|
{% if prometheus_redis_multi_instances_exporter_targets is defined %}
|
|
|
|
|
# Redis exporter #
|
|
|
|
|
- job_name: 'redis_exporter_targets'
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_redis_multi_instances_exporter_targets %}
|
|
|
|
|
- {{ target }}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
metrics_path: /scrape
|
|
|
|
|
relabel_configs:
|
|
|
|
|
- source_labels: [__address__]
|
|
|
|
|
target_label: __param_target
|
|
|
|
|
- source_labels: [__param_target]
|
|
|
|
|
target_label: instance
|
|
|
|
|
- source_labels: [instance]
|
|
|
|
|
target_label: __address__
|
|
|
|
|
regex: 'redis://(.*):63..'
|
|
|
|
|
replacement: '${1}:9121'
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
2021-11-19 12:30:22 +01:00
|
|
|
|
{% if prometheus_redis_exporter_targets is defined %}
|
|
|
|
|
# Redis exporter #
|
|
|
|
|
- job_name: redis
|
|
|
|
|
scrape_interval: 30s
|
|
|
|
|
scrape_timeout: 10s
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets:
|
|
|
|
|
{% for target in prometheus_redis_exporter_targets %}
|
|
|
|
|
- {{ target }}:9121
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|