aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2024-05-01 16:24:12 +0200
committerGravatar jchristgit <[email protected]>2024-05-04 10:44:51 +0200
commitdeae3a4324530220511a7e156050c32a8fcd7c5c (patch)
treeef821e1a15367dbcb7e584570869ad9a15219207
parentSet up database group for database hosts (diff)
Set up Prometheus alerting on Netcup
-rw-r--r--ansible/roles/prometheus/defaults/main.yml6
-rw-r--r--ansible/roles/prometheus/tasks/main.yml14
2 files changed, 18 insertions, 2 deletions
diff --git a/ansible/roles/prometheus/defaults/main.yml b/ansible/roles/prometheus/defaults/main.yml
index fbefe91..fc2da50 100644
--- a/ansible/roles/prometheus/defaults/main.yml
+++ b/ansible/roles/prometheus/defaults/main.yml
@@ -19,8 +19,7 @@ prometheus_configuration:
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- # - "first_rules.yml"
- # - "second_rules.yml"
+ - "rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
@@ -43,3 +42,6 @@ prometheus_configuration:
# machine by default.
static_configs:
- targets: ['localhost:9100']
+
+prometheus_rules:
+ groups: []
diff --git a/ansible/roles/prometheus/tasks/main.yml b/ansible/roles/prometheus/tasks/main.yml
index b1bb67a..797d8a5 100644
--- a/ansible/roles/prometheus/tasks/main.yml
+++ b/ansible/roles/prometheus/tasks/main.yml
@@ -31,3 +31,17 @@
- role::prometheus
notify:
- Reload the prometheus service
+
+- name: Configure prometheus rules
+ copy:
+ content: |
+ # Ansible managed
+ {{ prometheus_rules | to_nice_yaml }}
+ dest: /etc/prometheus/rules.yml
+ owner: prometheus
+ group: prometheus
+ mode: "0400"
+ tags:
+ - role::prometheus
+ notify:
+ - Reload the prometheus service