diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 2ba249b..d9387c7 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -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 diff --git a/hosts b/hosts index 4daaa80..e4c8504 100644 --- a/hosts +++ b/hosts @@ -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 diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml new file mode 100644 index 0000000..6975180 --- /dev/null +++ b/roles/grafana/tasks/main.yml @@ -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 diff --git a/roles/prometheus/handlers/main.yml b/roles/prometheus/handlers/main.yml new file mode 100644 index 0000000..961a5ce --- /dev/null +++ b/roles/prometheus/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: Restart prometheus + service: name=prometheus state=restarted diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml new file mode 100644 index 0000000..c28df74 --- /dev/null +++ b/roles/prometheus/tasks/main.yml @@ -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 diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2 new file mode 100644 index 0000000..bac1557 --- /dev/null +++ b/roles/prometheus/templates/prometheus.yml.j2 @@ -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 %} diff --git a/site.yml b/site.yml index eb476e3..faeddee 100644 --- a/site.yml +++ b/site.yml @@ -29,3 +29,9 @@ hosts: confluence.regensburg.freifunk.net roles: - confluence + +- name: Setup stats server + hosts: stats.ffrgb + roles: + - prometheus + - grafana