change prometheus_server role variable structure
This commit is contained in:
parent
0363813807
commit
1b30ca221e
@ -28,24 +28,19 @@ users:
|
||||
openpgp:0xAD2BFD7F"
|
||||
opendoas_settings: "permit nopass ansible"
|
||||
|
||||
prometheus_options:
|
||||
prometheus_settings:
|
||||
config:
|
||||
global:
|
||||
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets:
|
||||
- 192.168.0.252:9093
|
||||
|
||||
rule_files:
|
||||
- alerting_rules/*.yml
|
||||
|
||||
scrape_configs:
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets:
|
||||
- 192.168.0.252:9090
|
||||
|
||||
- job_name: node
|
||||
static_configs:
|
||||
- targets:
|
||||
@ -90,7 +85,6 @@ prometheus_options:
|
||||
labels:
|
||||
env: common
|
||||
hostname: monitoring
|
||||
|
||||
- job_name: nginx
|
||||
static_configs:
|
||||
- targets:
|
||||
@ -100,43 +94,7 @@ prometheus_options:
|
||||
env: common
|
||||
hostname: monitoring
|
||||
|
||||
|
||||
|
||||
prometheus_alertmanager_options:
|
||||
global:
|
||||
smtp_smarthost: mail.cuqmbr.xyz:587
|
||||
smtp_require_tls: true
|
||||
smtp_from: '"Homelab Alertmanager" <no-reply@cuqmbr.xyz>'
|
||||
smtp_auth_username: no-reply
|
||||
smtp_auth_password: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
31393866316539633838303936366464613935393933333338336531656239333361653664346637
|
||||
3665316532336339633432303036626339363239343065630a326361306233656632653134643966
|
||||
39663138303439323636666665653364396132333532383463626337653061356461643734336363
|
||||
6266353533656566330a346536333836356131343832616631666330653462613436313062643330
|
||||
61616664646439643839366630396137616533393664323965366630363566333632
|
||||
|
||||
templates:
|
||||
- /etc/prometheus/alertmanager_templates/*.tmpl
|
||||
|
||||
route:
|
||||
group_by:
|
||||
- env
|
||||
- hostname
|
||||
|
||||
group_wait: 30s
|
||||
group_interval: 5m
|
||||
repeat_interval: 1d
|
||||
receiver: default
|
||||
|
||||
receivers:
|
||||
- name: default
|
||||
email_configs:
|
||||
- to: notifications@cuqmbr.xyz
|
||||
|
||||
|
||||
|
||||
prometheus_alerting_rules:
|
||||
alerting_rules:
|
||||
groups:
|
||||
- name: DefaultMetrics
|
||||
rules:
|
||||
@ -243,6 +201,40 @@ prometheus_alerting_rules:
|
||||
description: "Clock not synchronising. Ensure NTP is configured on this host.\n VALUE = {{'{{'}} $value {{'}}'}}\n LABELS = {{'{{'}} $labels {{'}}'}}"
|
||||
|
||||
|
||||
|
||||
prometheus_alertmanager_options:
|
||||
global:
|
||||
smtp_smarthost: mail.cuqmbr.xyz:587
|
||||
smtp_require_tls: true
|
||||
smtp_from: '"Homelab Alertmanager" <no-reply@cuqmbr.xyz>'
|
||||
smtp_auth_username: no-reply
|
||||
smtp_auth_password: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
31393866316539633838303936366464613935393933333338336531656239333361653664346637
|
||||
3665316532336339633432303036626339363239343065630a326361306233656632653134643966
|
||||
39663138303439323636666665653364396132333532383463626337653061356461643734336363
|
||||
6266353533656566330a346536333836356131343832616631666330653462613436313062643330
|
||||
61616664646439643839366630396137616533393664323965366630363566333632
|
||||
|
||||
templates:
|
||||
- /etc/prometheus/alertmanager_templates/*.tmpl
|
||||
|
||||
route:
|
||||
group_by:
|
||||
- env
|
||||
- hostname
|
||||
|
||||
group_wait: 30s
|
||||
group_interval: 5m
|
||||
repeat_interval: 1d
|
||||
receiver: default
|
||||
|
||||
receivers:
|
||||
- name: default
|
||||
email_configs:
|
||||
- to: notifications@cuqmbr.xyz
|
||||
|
||||
|
||||
loki_settings:
|
||||
config:
|
||||
auth_enabled: false
|
||||
|
@ -1,59 +1,53 @@
|
||||
---
|
||||
|
||||
prometheus_options:
|
||||
prometheus_settings:
|
||||
|
||||
prometheus_default_settings:
|
||||
config:
|
||||
global:
|
||||
# Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||
scrape_interval: 15s
|
||||
# Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||
evaluation_interval: 15s
|
||||
# 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:
|
||||
monitor: 'example'
|
||||
|
||||
# external_labels:
|
||||
# monitor: 'example'
|
||||
# Alertmanager configuration
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets: ['localhost:9093']
|
||||
|
||||
# Load rules and evaluate them according to the global 'evaluation_interval'.
|
||||
# alerting:
|
||||
# alertmanagers:
|
||||
# - static_configs:
|
||||
# - targets: ['localhost:9093']
|
||||
# Load rules and evaluate them according to the global 'evaluation_interval'
|
||||
rule_files:
|
||||
- alerting_rules/*.yml
|
||||
|
||||
# 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>`.
|
||||
- job_name: 'prometheus'
|
||||
|
||||
# Override the global default and scrape targets from this job.
|
||||
scrape_interval: 5s
|
||||
scrape_timeout: 5s
|
||||
|
||||
# metrics_path defaults to '/metrics'
|
||||
# scheme defaults to 'http'.
|
||||
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
- job_name: node
|
||||
# If prometheus-node-exporter is installed, grab stats about the local
|
||||
# machine by default.
|
||||
static_configs:
|
||||
- targets: ['localhost:9100']
|
||||
|
||||
prometheus_alerting_rules:
|
||||
groups:
|
||||
- name: ExampleRedisGroup
|
||||
rules:
|
||||
- alert: ExampleRedisDown
|
||||
expr: redis_up{} == 0
|
||||
for: 2m
|
||||
labels:
|
||||
severity: critical
|
||||
annotations:
|
||||
summary: "Redis instance down"
|
||||
description: "Whatever"
|
||||
alerting_rules:
|
||||
# groups:
|
||||
# - name: ExampleRedisGroup
|
||||
# rules:
|
||||
# - alert: ExampleRedisDown
|
||||
# expr: redis_up{} == 0
|
||||
# for: 2m
|
||||
# labels:
|
||||
# severity: critical
|
||||
# annotations:
|
||||
# summary: "Redis instance down"
|
||||
# description: "Whatever"
|
||||
|
@ -1,5 +1,11 @@
|
||||
---
|
||||
|
||||
- name: Combine default and user settings, decrypt vault.
|
||||
ansible.builtin.set_fact:
|
||||
prometheus_settings: "{{ prometheus_default_settings |
|
||||
ansible.builtin.combine(prometheus_settings, recursive=true) }}"
|
||||
no_log: true
|
||||
|
||||
- name: Install prometheus apt package.
|
||||
ansible.builtin.apt:
|
||||
name: prometheus
|
||||
|
@ -1,4 +1,7 @@
|
||||
---
|
||||
# Managed with Ansible
|
||||
|
||||
{{ prometheus_alerting_rules | ansible.builtin.to_nice_yaml(indent=2) }}
|
||||
{{
|
||||
prometheus_settings.alerting_rules |
|
||||
ansible.builtin.to_nice_yaml(indent=2)
|
||||
}}
|
||||
|
@ -1,4 +1,7 @@
|
||||
---
|
||||
# Managed with Ansible
|
||||
|
||||
{{ prometheus_options | ansible.builtin.to_nice_yaml(indent=2) }}
|
||||
{{
|
||||
prometheus_settings.config |
|
||||
ansible.builtin.to_nice_yaml(indent=2, width=80)
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user