forked from infra/ansible
prometheus: new role
This commit is contained in:
parent
634b952321
commit
e2fd44eb53
4
roles/prometheus/handlers/main.yml
Normal file
4
roles/prometheus/handlers/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
- name: Restart prometheus
|
||||
service: name=prometheus state=restarted
|
14
roles/prometheus/tasks/main.yml
Normal file
14
roles/prometheus/tasks/main.yml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
|
||||
- name: Enable backports for prometheus
|
||||
apt_repository: repo='deb http://httpredir.debian.org/debian stretch-backports main'
|
||||
|
||||
- name: Install prometheus
|
||||
apt: name=prometheus default_release='stretch-backports'
|
||||
|
||||
- name: Configure prometheus
|
||||
template: src=prometheus.yml.j2 dest=/etc/prometheus/prometheus.yml
|
||||
notify: Restart prometheus
|
||||
|
||||
- name: Enable prometheus
|
||||
service: name=prometheus state=started enabled=yes
|
35
roles/prometheus/templates/prometheus.yml.j2
Normal file
35
roles/prometheus/templates/prometheus.yml.j2
Normal file
@ -0,0 +1,35 @@
|
||||
# Sample config for Prometheus.
|
||||
|
||||
global:
|
||||
scrape_interval: 60s
|
||||
evaluation_interval: 60s
|
||||
# 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'
|
||||
|
||||
# Alertmanager configuration
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets:
|
||||
# - localhost:9093
|
||||
|
||||
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||
rule_files:
|
||||
# - "first_rules.yml"
|
||||
# - "second_rules.yml"
|
||||
|
||||
# A scrape configuration containing exactly one endpoint to scrape:
|
||||
# Here it's Prometheus itself.
|
||||
scrape_configs:
|
||||
{% if node_targets is defined %}
|
||||
- job_name: node
|
||||
static_configs:
|
||||
- targets:
|
||||
{% for target in node_targets %}
|
||||
- {{ target }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
Loading…
Reference in New Issue
Block a user