2021-05-29 14:45:55 +00:00
|
|
|
---
|
|
|
|
title: prometheus
|
|
|
|
type: docs
|
|
|
|
---
|
|
|
|
|
2022-03-03 20:31:53 +00:00
|
|
|
[![Source Code](https://img.shields.io/badge/gitea-source%20code-blue?logo=gitea&logoColor=white)](https://gitea.rknet.org/ansible/xoxys.prometheus) [![Build Status](https://img.shields.io/drone/build/ansible/xoxys.prometheus?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/ansible/xoxys.prometheus) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](https://gitea.rknet.org/ansible/xoxys.prometheus/src/branch/master/LICENSE)
|
2021-05-29 14:45:55 +00:00
|
|
|
|
2021-05-30 10:30:27 +00:00
|
|
|
Deploy [Prometheus](https://prometheus.io/) monitoring system.
|
2021-05-29 14:45:55 +00:00
|
|
|
|
2022-03-03 20:31:53 +00:00
|
|
|
- [Default Variables](#default-variables)
|
|
|
|
- [prometheus_alert_relabel_configs](#prometheus_alert_relabel_configs)
|
|
|
|
- [prometheus_alert_rules](#prometheus_alert_rules)
|
|
|
|
- [prometheus_alert_rules_extra](#prometheus_alert_rules_extra)
|
|
|
|
- [prometheus_alert_rules_files](#prometheus_alert_rules_files)
|
|
|
|
- [prometheus_alertmanager_config](#prometheus_alertmanager_config)
|
|
|
|
- [prometheus_base_dir](#prometheus_base_dir)
|
|
|
|
- [prometheus_config_dir](#prometheus_config_dir)
|
|
|
|
- [prometheus_config_flags_extra](#prometheus_config_flags_extra)
|
|
|
|
- [prometheus_data_dir](#prometheus_data_dir)
|
|
|
|
- [prometheus_external_labels](#prometheus_external_labels)
|
|
|
|
- [prometheus_extra_groups](#prometheus_extra_groups)
|
|
|
|
- [prometheus_file_sd_dir](#prometheus_file_sd_dir)
|
|
|
|
- [prometheus_global](#prometheus_global)
|
|
|
|
- [prometheus_group](#prometheus_group)
|
|
|
|
- [prometheus_log_level](#prometheus_log_level)
|
|
|
|
- [prometheus_packages](#prometheus_packages)
|
|
|
|
- [prometheus_read_only_dirs](#prometheus_read_only_dirs)
|
|
|
|
- [prometheus_remote_read](#prometheus_remote_read)
|
|
|
|
- [prometheus_remote_write](#prometheus_remote_write)
|
|
|
|
- [prometheus_rules_dir](#prometheus_rules_dir)
|
|
|
|
- [prometheus_scrape_configs](#prometheus_scrape_configs)
|
|
|
|
- [prometheus_static_targets_files](#prometheus_static_targets_files)
|
|
|
|
- [prometheus_storage_retention](#prometheus_storage_retention)
|
|
|
|
- [prometheus_storage_retention_size](#prometheus_storage_retention_size)
|
|
|
|
- [prometheus_targets](#prometheus_targets)
|
|
|
|
- [prometheus_user](#prometheus_user)
|
|
|
|
- [prometheus_user_comment](#prometheus_user_comment)
|
|
|
|
- [prometheus_user_home](#prometheus_user_home)
|
|
|
|
- [prometheus_version](#prometheus_version)
|
|
|
|
- [prometheus_web_basic_auth_users](#prometheus_web_basic_auth_users)
|
|
|
|
- [prometheus_web_bind_ip](#prometheus_web_bind_ip)
|
|
|
|
- [prometheus_web_bind_port](#prometheus_web_bind_port)
|
|
|
|
- [prometheus_web_external_url](#prometheus_web_external_url)
|
|
|
|
- [prometheus_web_http_server](#prometheus_web_http_server)
|
|
|
|
- [prometheus_web_tls_cert_path](#prometheus_web_tls_cert_path)
|
|
|
|
- [prometheus_web_tls_cert_source](#prometheus_web_tls_cert_source)
|
|
|
|
- [prometheus_web_tls_enabled](#prometheus_web_tls_enabled)
|
|
|
|
- [prometheus_web_tls_key_path](#prometheus_web_tls_key_path)
|
|
|
|
- [prometheus_web_tls_key_source](#prometheus_web_tls_key_source)
|
|
|
|
- [Discovered Tags](#discovered-tags)
|
|
|
|
- [Dependencies](#dependencies)
|
2021-05-29 14:45:55 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Default Variables
|
|
|
|
|
|
|
|
### prometheus_alert_relabel_configs
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_alert_relabel_configs: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_alert_relabel_configs:
|
|
|
|
- action: labeldrop
|
|
|
|
regex: replica
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_alert_rules
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_alert_rules:
|
|
|
|
- alert: Watchdog
|
|
|
|
expr: vector(1)
|
|
|
|
for: 10m
|
|
|
|
labels:
|
|
|
|
severity: warning
|
|
|
|
annotations:
|
2022-03-03 20:31:53 +00:00
|
|
|
description: >-
|
|
|
|
This is an alert meant to ensure that the entire alerting pipeline is functional.
|
|
|
|
This alert is always firing. There are integrations with various notification
|
|
|
|
mechanisms that send a notification when this alert is not firing anymore.
|
2021-05-29 14:45:55 +00:00
|
|
|
summary: Ensure entire alerting pipeline is functional
|
|
|
|
- alert: InstanceDown
|
|
|
|
expr: up == 0
|
|
|
|
for: 5m
|
|
|
|
labels:
|
|
|
|
severity: critical
|
|
|
|
annotations:
|
|
|
|
description: '{% raw %}{{ $labels.instance }} of job {{ $labels.job }} has been
|
|
|
|
down for more than 5 minutes.{% endraw %}'
|
|
|
|
summary: '{% raw %}Instance {{ $labels.instance }} down{% endraw %}'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_alert_rules_extra
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_alert_rules_extra: []
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_alert_rules_files
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_alert_rules_files:
|
|
|
|
- prometheus/rules/*.rules
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_alertmanager_config
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_alertmanager_config: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_alertmanager_config:
|
|
|
|
- scheme: https
|
|
|
|
path_prefix: alertmanager/
|
|
|
|
basic_auth:
|
|
|
|
username: user
|
|
|
|
password: pass
|
|
|
|
static_configs:
|
|
|
|
- targets: ["127.0.0.1:9093"]
|
|
|
|
proxy_url: "127.0.0.2"
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_base_dir
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_base_dir: /opt/prometheus
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_config_dir
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_config_dir: '{{ prometheus_base_dir }}/conf'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_config_flags_extra
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_config_flags_extra: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_config_flags_extra:
|
|
|
|
- name: alertmanager.timeout
|
2021-05-29 15:59:58 +00:00
|
|
|
value: 10s
|
2021-05-29 14:45:55 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_data_dir
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_data_dir: '{{ prometheus_base_dir }}/data'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_external_labels
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_external_labels:
|
|
|
|
environment: '{{ ansible_fqdn | default(ansible_host) | default(inventory_hostname)
|
|
|
|
}}'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_extra_groups
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_extra_groups: []
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_file_sd_dir
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_file_sd_dir: '{{ prometheus_config_dir }}/file_sd'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_global
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_global:
|
|
|
|
scrape_interval: 15s
|
|
|
|
scrape_timeout: 10s
|
|
|
|
evaluation_interval: 15s
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_group
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_group: '{{ prometheus_user }}'
|
|
|
|
```
|
|
|
|
|
2021-05-29 15:59:58 +00:00
|
|
|
### prometheus_log_level
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_log_level: error
|
|
|
|
```
|
|
|
|
|
2021-05-29 14:45:55 +00:00
|
|
|
### prometheus_packages
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
2022-01-26 20:07:39 +00:00
|
|
|
prometheus_packages:
|
|
|
|
- tar
|
2021-05-29 14:45:55 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_read_only_dirs
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_read_only_dirs: []
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_remote_read
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_remote_read: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_remote_read:
|
|
|
|
- url: https://demo.cloudalchemy.org:9201/read
|
|
|
|
basic_auth:
|
|
|
|
password: FOO
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_remote_write
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_remote_write: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_remote_write:
|
|
|
|
- url: https://dev.kausal.co/prom/push
|
|
|
|
basic_auth:
|
|
|
|
password: FOO
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_rules_dir
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_rules_dir: '{{ prometheus_config_dir }}/rules'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_scrape_configs
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_scrape_configs:
|
|
|
|
- job_name: prometheus
|
2021-05-29 15:59:58 +00:00
|
|
|
metrics_path: "{{ prometheus_web_external_url | urlsplit('path') if (prometheus_web_external_url\
|
|
|
|
\ | urlsplit('path')) | length > 1 else '' }}/metrics"
|
2021-05-29 14:45:55 +00:00
|
|
|
static_configs:
|
|
|
|
- targets:
|
2021-05-29 19:50:53 +00:00
|
|
|
- "{{ ansible_fqdn | default(ansible_host) | default('localhost') }}:61000"
|
2021-05-29 14:45:55 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_static_targets_files
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_static_targets_files:
|
|
|
|
- prometheus/targets/*.yml
|
|
|
|
- prometheus/targets/*.json
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_storage_retention
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_storage_retention: 30d
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_storage_retention_size
|
|
|
|
|
2021-05-30 11:13:02 +00:00
|
|
|
__[EXPERIMENTAL]__ Maximum number of bytes that can be stored for blocks.
|
2021-05-29 14:45:55 +00:00
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_storage_retention_size: '0'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_targets
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_targets: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_targets:
|
|
|
|
- name: node
|
|
|
|
config:
|
|
|
|
- targets:
|
|
|
|
- localhost:9100
|
|
|
|
labels:
|
|
|
|
env: test
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_user
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_user: prometheus_adm
|
|
|
|
```
|
|
|
|
|
2021-07-29 19:52:04 +00:00
|
|
|
### prometheus_user_comment
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_user_comment: Prometheus
|
|
|
|
```
|
|
|
|
|
2021-05-29 14:45:55 +00:00
|
|
|
### prometheus_user_home
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_user_home: /home/{{ prometheus_user }}
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_version
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_version: 2.27.0
|
|
|
|
```
|
|
|
|
|
2021-05-29 15:59:58 +00:00
|
|
|
### prometheus_web_basic_auth_users
|
|
|
|
|
|
|
|
See official [documentation](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_web_basic_auth_users: _unset_
|
|
|
|
```
|
|
|
|
|
2021-05-29 14:45:55 +00:00
|
|
|
### prometheus_web_bind_ip
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_web_bind_ip: 127.0.0.1
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_web_bind_port
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
2021-05-29 19:50:53 +00:00
|
|
|
prometheus_web_bind_port: 61000
|
2021-05-29 14:45:55 +00:00
|
|
|
```
|
|
|
|
|
2021-05-29 15:59:58 +00:00
|
|
|
### prometheus_web_external_url
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
2021-05-29 19:50:53 +00:00
|
|
|
prometheus_web_external_url: http://localhost:61000/
|
2021-05-29 15:59:58 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_web_http_server
|
2021-05-29 14:45:55 +00:00
|
|
|
|
|
|
|
See official [documentation](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
2021-05-29 15:59:58 +00:00
|
|
|
prometheus_web_http_server: _unset_
|
2021-05-29 14:45:55 +00:00
|
|
|
```
|
|
|
|
|
2021-05-29 15:59:58 +00:00
|
|
|
### prometheus_web_tls_cert_path
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_web_tls_cert_path: '{{ prometheus_base_dir }}/tls/certs/mycert.pem'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_web_tls_cert_source
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_web_tls_cert_source: mycert.pem
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_web_tls_enabled
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_web_tls_enabled: false
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_web_tls_key_path
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
prometheus_web_tls_key_path: '{{ prometheus_base_dir }}/tls/private/mykey.pem'
|
|
|
|
```
|
|
|
|
|
|
|
|
### prometheus_web_tls_key_source
|
2021-05-29 14:45:55 +00:00
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
2021-05-29 15:59:58 +00:00
|
|
|
prometheus_web_tls_key_source: mykey.pem
|
2021-05-29 14:45:55 +00:00
|
|
|
```
|
|
|
|
|
2022-03-03 20:31:53 +00:00
|
|
|
## Discovered Tags
|
|
|
|
|
|
|
|
tls_renewal
|
|
|
|
:
|
|
|
|
|
|
|
|
|
2021-05-29 14:45:55 +00:00
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
None.
|