Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions hosts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ gateways:
ffsh_fastd_mac: 00:5b:27:80:00:64
enable_wireguard_exit: true
owner: ulf
blackbox_http_url: https://beste.freifunk-suedholstein.de/
brunsbach:
ansible_ssh_host: 159.69.251.9
external_ipv4: 159.69.251.9
Expand All @@ -26,6 +27,7 @@ gateways:
ffsh_fastd_mac: 00:5b:27:80:00:96
enable_wireguard_exit: true
owner: benjamin
blackbox_http_url: https://brunsbach.freifunk-suedholstein.de/
trave:
ansible_ssh_host: 88.99.86.15
external_ipv4: 88.99.86.15
Expand All @@ -39,15 +41,18 @@ gateways:
ffsh_fastd_mac: 00:5b:27:80:02:08
enable_wireguard_exit: true
owner: ulf
blackbox_http_url: https://trave.freifunk-suedholstein.de/
vars:
ansible_user: root

services:
hosts:
map-ffsh:
ansible_ssh_host: 116.203.148.80
blackbox_http_url: https://map.freifunk-suedholstein.de/
web-ffsh:
ansible_ssh_host: 116.203.27.68
blackbox_http_url: https://freifunk-suedholstein.de/
vars:
ansible_user: root

Expand Down
4 changes: 4 additions & 0 deletions roles/blackbox_exporter/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Restart blackbox exporter
ansible.builtin.systemd:
name: prometheus-blackbox-exporter
state: restarted
20 changes: 20 additions & 0 deletions roles/blackbox_exporter/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- name: Install blackbox exporter
ansible.builtin.apt:
name: prometheus-blackbox-exporter
state: present
update_cache: true

- name: Configure blackbox exporter
ansible.builtin.template:
src: blackbox.yml.j2
dest: /etc/prometheus/blackbox.yml
owner: root
group: root
mode: "0644"
notify: Restart blackbox exporter

- name: Enable and start blackbox exporter
ansible.builtin.systemd:
name: prometheus-blackbox-exporter
enabled: true
state: started
6 changes: 6 additions & 0 deletions roles/blackbox_exporter/templates/blackbox.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
modules:
http_2xx:
prober: http
timeout: 10s
http:
follow_redirects: true
21 changes: 21 additions & 0 deletions roles/prometheus/templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ scrape_configs:
static_configs:
- targets: ["localhost:9090"]

- job_name: "blackbox-http"

metrics_path: /probe
params:
module: [http_2xx]

static_configs:
{% for target in groups['gateways'] + groups['services'] %}
- targets: ["{{ hostvars[target].blackbox_http_url }}"]
labels:
instance: "{{ target }}"
{% endfor %}

relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115

- job_name: "gateways"

metrics_path: stats/metrics
Expand Down
1 change: 1 addition & 0 deletions setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
# ansible.builtin.apt:
# update_cache: true
roles:
- {role: blackbox_exporter, tags: "blackbox-exporter"}
- {role: prometheus, tags: "prometheus"}

post_tasks:
Expand Down