Add new prometheus/grafana roles

This commit is contained in:
Markus 2018-07-19 16:29:44 +02:00
parent b8cf1837e9
commit c00b5f854e
7 changed files with 75 additions and 0 deletions

View File

@ -25,6 +25,14 @@ gre_matrix:
- { id: 26, a: gw21, b: gw31 }
# - { id: 33, a: gw22, b: gw31 }
node_targets:
- gw11.regensburg.freifunk.net:9100
- gw21.regensburg.freifunk.net:9100
- gw31.regensburg.freifunk.net:9100
- confluence.regensburg.freifunk.net:9100
- stats.ffrgb:9100
- unms.ffrgb:9100
ntp_servers:
- 0.de.pool.ntp.org
- 1.de.pool.ntp.org

1
hosts
View File

@ -3,4 +3,5 @@ gw11.regensburg.freifunk.net
gw21.regensburg.freifunk.net
gw31.regensburg.freifunk.net
confluence.regensburg.freifunk.net
stats.ffrgb ansible_host=10.90.224.100
unms.ffrgb ansible_host=10.90.224.101

View File

@ -0,0 +1,10 @@
---
- name: Enable grafana apt-key
apt_key: url='https://packagecloud.io/gpg.key'
- name: Enable grafana repository
apt_repository: repo='deb https://packagecloud.io/grafana/stable/debian/ stretch main'
- name: Install grafana
apt: name=grafana

View File

@ -0,0 +1,3 @@
---
- name: Restart prometheus
service: name=prometheus state=restarted

View 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 enabled=yes

View File

@ -0,0 +1,33 @@
# 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:
- job_name: node
static_configs:
- targets:
{% for target in node_targets %}
- {{ target }}
{% endfor %}

View File

@ -29,3 +29,9 @@
hosts: confluence.regensburg.freifunk.net
roles:
- confluence
- name: Setup stats server
hosts: stats.ffrgb
roles:
- prometheus
- grafana