aboutsummaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/prometheus/tasks/main.yml19
-rw-r--r--roles/prometheus/templates/prometheus.conf.j228
2 files changed, 47 insertions, 0 deletions
diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml
index aacdb65..ba5095b 100644
--- a/roles/prometheus/tasks/main.yml
+++ b/roles/prometheus/tasks/main.yml
@@ -7,5 +7,24 @@
- name: install prometheus
package: name=prometheus state=present
+- name: install node_exporter
+ package: name="{{ packages[os_distribution].node_exporter }}" state=present
+
+- name: generate prometheus configuration
+ template:
+ src: prometheus.conf.j2
+ dest: "{{ path_prometheusconfig }}"
+ owner: "{{ user_root }}"
+ group: "{{ group_root }}"
+ mode: 0644
+
- name: ensure prometheus service is started and enabled
service: name=prometheus state=restarted enabled=true
+
+- name: start and enable node_exporter
+ service: name=node_exporter state=restarted enabled=true
+ when: os_type == "bsd"
+
+- name: start and enable node_exporter
+ service: name=node-exporter state=restarted enabled=true
+ when: os_type != "bsd"
diff --git a/roles/prometheus/templates/prometheus.conf.j2 b/roles/prometheus/templates/prometheus.conf.j2
new file mode 100644
index 0000000..faf3581
--- /dev/null
+++ b/roles/prometheus/templates/prometheus.conf.j2
@@ -0,0 +1,28 @@
+
+# prometheus configuration ~~ {{ path_prometheusconfig }}
+# managed by Ansible
+
+global:
+ scrape_interval: 15s
+ evaluation_interval: 15s
+
+alerting:
+ alertmanagers:
+ - static_configs:
+ - targets:
+ # - alertmanager:9093
+
+rule_files:
+ # - "first_rules.yml"
+ # - "second_rules.yml"
+
+scrape_configs:
+
+ - job_name: "prometheus"
+ static_configs:
+ - targets: ["127.0.0.1:9090"]
+
+ - job_name: "node_exporter"
+ scrape_interval: 5s
+ static_configs:
+ - targets: ["127.0.0.1:9100"]
remember that computers suck.