prometheus: install alertmanager

This commit is contained in:
uumas
2023-12-21 01:18:27 +02:00
parent 8dc0ec798f
commit 44665bae12
4 changed files with 28 additions and 1 deletions

View File

@@ -5,3 +5,7 @@ prometheus_evaluation_interval: 15s
prometheus_storage_retention: 3650d
prometheus_install_grafana: false
prometheus_hcloud_relabel_configs: []
prometheus_install_alertmanager: true
alertmanager_storage_retention: "{{ prometheus_storage_retention }}"

View File

@@ -40,11 +40,24 @@ argument_specs:
replacement:
type: str
required: false
prometheus_install_grafana:
description: If true, installs grafana in the same docker network as prometheus and configures it with prometheus as data source
type: bool
required: false
default: false
prometheus_install_alertmanager:
description: If true, installs alertmanager in the same docker network as prometheus and configures it
type: bool
required: false
default: true
alertmanager_storage_retention:
description: Period of time for which alertmanager data is stored for. A number followed by unit (s, m, h, d, w, y). Passed directly to alertmanager role
type: str
required: false
default: "{{ prometheus_storage_retention | default('3650d') }}"
# All options after this will be passed directly to the container role
docker_service_suffix:

View File

@@ -23,6 +23,14 @@
- copypath: alerting
path: /etc/prometheus/alerting
- name: Alertmanager container for prometheus
include_role:
name: alertmanager
vars:
docker_networks:
- name: prometheus
when: prometheus_install_alertmanager
- name: Grafana container for prometheus
include_role:
name: grafana

View File

@@ -10,7 +10,9 @@ alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
{% if prometheus_install_alertmanager %}
- alertmanager:9093
{%- endif %}
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files: