playbooks: add ffmwu-monitoring to set up prometheus servers

This commit is contained in:
Julian Labus 2018-09-09 10:33:15 +02:00
parent 8d7af519a5
commit ae243c872f
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A
5 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1 @@
[ffmwu-monitoring]

View file

@ -12,6 +12,12 @@ bgp_ipv4_transfer_net: 10.37.0.0/18
bgp_ipv6_transfer_net: fd37:b4dc:4b1e::/64
bgp_groups:
- ffmwu-gateways
- ffmwu-monitoring
prometheus_groups:
- ffmwu-gateways
prometheus_conf_main: prometheus/prometheus.yml.j2
http_domain_internal: ffmwu.org
http_domain_external: freifunk-mwu.de

View file

@ -0,0 +1,13 @@
---
routing_tables:
mwu: 41
common_repos:
backend-scripts:
repo_url: https://github.com/freifunk-mwu/backend-scripts.git
version: ansible
prometheus_components:
- prometheus
- alertmanager
- node_exporter

26
playbooks/monitoring.yml Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/ansible-playbook
- hosts: ffmwu-monitoring
remote_user: admin
roles:
- prerequisites
- server-apt-repos
- server-basic
- users
- system-sysctl
- git-repos
- service-haveged
- service-ntpd
- kmod-batman
- network-routetables
- network-batman
- network-meshbridge
- network-fastd
- network-routing
- service-nginx
- service-fastd
- service-fastd-backbone
- service-bird
- service-respondd
- service-nullmailer
- service-prometheus

View file

@ -0,0 +1,42 @@
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
# scrape_timeout is set to the global default (10s).
# The labels to add to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'master'
{% if prometheus_rule_files is defined %}
# Rule files specifies a list of files from which rules are read.
rule_files:
{% for (key, value) in prometheus_rule_files.items() %}
- {{ prometheus_rule_path }}/{{ value.dest }}
{% endfor %}
{% endif %}
# A list of scrape configurations.
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 10s
scrape_timeout: 10s
static_configs:
- targets: ['localhost:9090', 'localhost:9100']
- job_name: "node"
file_sd_configs:
- files:
- '{{ prometheus_file_sd_config_path }}/*.json'
- '{{ prometheus_file_sd_config_path }}/*.yml'
- '{{ prometheus_file_sd_config_path }}/*.yaml'
static_configs:
{%for group in prometheus_groups %}
- targets:
{% for host in groups[group] %}
- '{{ host }}:9100'
{% endfor %}
labels:
group: '{{ group }}'
{% endfor %}