summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.yamllint3
-rw-r--r--host_vars/rpi5.local.ymlbin2618 -> 3115 bytes
-rw-r--r--host_vars/rpi5.local.yml.example24
-rw-r--r--molecule/raspberrypi/converge.yml5
-rw-r--r--roles/grafana/meta/argument_specs.yml14
-rw-r--r--roles/grafana/tasks/main.yml6
-rw-r--r--roles/prometheus/defaults/main.yml1
-rw-r--r--roles/prometheus/meta/argument_specs.yml5
-rw-r--r--roles/prometheus/templates/prometheus.yml.j28
9 files changed, 42 insertions, 24 deletions
diff --git a/.yamllint b/.yamllint
index 3df54a17..88c05eb8 100644
--- a/.yamllint
+++ b/.yamllint
@@ -5,6 +5,9 @@ rules:
line-length:
max: 120
level: warning
+ ignore: |
+ host_vars/
+ group_vars/
comments:
min-spaces-from-content: 1
comments-indentation: false
diff --git a/host_vars/rpi5.local.yml b/host_vars/rpi5.local.yml
index ae758bf5..757769fe 100644
--- a/host_vars/rpi5.local.yml
+++ b/host_vars/rpi5.local.yml
Binary files differ
diff --git a/host_vars/rpi5.local.yml.example b/host_vars/rpi5.local.yml.example
index 702f99b5..14372b7f 100644
--- a/host_vars/rpi5.local.yml.example
+++ b/host_vars/rpi5.local.yml.example
@@ -51,29 +51,35 @@ prometheus_port: 9090
prometheus_retention: "15d"
prometheus_scrape_interval: "15s"
prometheus_node_exporter_port: 9100
+prometheus_extra_scrape_configs:
+ - name: "garage"
+ targets: ["localhost:{{ garage_admin_port }}"]
+ metrics_path: "/metrics"
grafana_port: 3000
grafana_admin_user: "admin"
grafana_admin_password: "changeme"
grafana_database_type: "sqlite3"
grafana_dashboards:
- - id: 1860
- revision: 37
- name: "node-exporter-full"
+ - name: "node-exporter-full"
+ url: "https://grafana.com/api/dashboards/1860/revisions/45/download"
datasource_mappings:
- key: "000000001"
value: "prometheus"
- - id: 3662
- revision: 2
- name: "prometheus-overview"
+ - name: "prometheus-overview"
+ url: "https://grafana.com/api/dashboards/3662/revisions/2/download"
datasource_mappings:
- key: "${DS_THEMIS}"
value: "prometheus"
- - id: 11074
- revision: 9
- name: "node-exporter-prometheus"
+ - name: "node-exporter-prometheus"
+ url: "https://grafana.com/api/dashboards/11074/revisions/9/download"
datasource_mappings:
- key: "${DS__VICTORIAMETRICS}"
value: "prometheus"
+ - name: "garage"
+ url: "https://git.deuxfleurs.fr/Deuxfleurs/garage/raw/branch/main/script/telemetry/grafana-garage-dashboard-prometheus.json"
+ datasource_mappings:
+ - key: "${DS_prometheus}"
+ value: "prometheus"
backup_device: "UUID=changeme"
diff --git a/molecule/raspberrypi/converge.yml b/molecule/raspberrypi/converge.yml
index 75e3d693..6c19f3c1 100644
--- a/molecule/raspberrypi/converge.yml
+++ b/molecule/raspberrypi/converge.yml
@@ -67,9 +67,8 @@
gateway_enabled: true
gateway_local_ipv4_subnet: "10.0.0.0/24"
grafana_dashboards:
- - id: 1860
- revision: 37
- name: "node-exporter-full"
+ - name: "node-exporter-full"
+ url: "https://grafana.com/api/dashboards/1860/revisions/45/download"
datasource_mappings:
- key: "000000001"
value: "prometheus"
diff --git a/roles/grafana/meta/argument_specs.yml b/roles/grafana/meta/argument_specs.yml
index 5a38b97d..c9d53bb1 100644
--- a/roles/grafana/meta/argument_specs.yml
+++ b/roles/grafana/meta/argument_specs.yml
@@ -53,23 +53,19 @@ argument_specs:
description: "FQDN for the grafana nginx vhost (e.g. 'monitor.home.arpa')."
default: "monitor.home.arpa"
grafana_dashboards:
- description: "List of community dashboards to download and provision"
+ description: "List of dashboards to download and provision"
type: "list"
elements: "dict"
default: []
options:
- id:
- description: "Grafana.com dashboard ID"
- type: "int"
- required: true
- revision:
- description: "Dashboard revision number"
- type: "int"
- required: true
name:
description: "Local name for the dashboard file"
type: "str"
required: true
+ url:
+ description: "URL to download the dashboard JSON from"
+ type: "str"
+ required: true
datasource_mappings:
description: "List of datasource variable mappings for the dashboard"
type: "list"
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
index f7b7d851..088d61c7 100644
--- a/roles/grafana/tasks/main.yml
+++ b/roles/grafana/tasks/main.yml
@@ -53,7 +53,7 @@
notify: "Restart grafana"
no_log: true
-- name: "Provision Grafana community dashboards"
+- name: "Provision Grafana dashboards"
notify: "Restart grafana"
# grafana downloaded dashboards are being rewritten after successful download
# this is to correct the datasource mapping in the downloaded files
@@ -61,10 +61,10 @@
tags:
- molecule-idempotence-notest
block:
- - name: "Download Grafana community dashboards"
+ - name: "Download Grafana dashboards"
become: true
ansible.builtin.get_url:
- url: "https://grafana.com/api/dashboards/{{ item.id }}/revisions/{{ item.revision }}/download"
+ url: "{{ item.url }}"
dest: "/etc/grafana/provisioning/dashboards/{{ item.name }}.json"
owner: "grafana"
group: "grafana"
diff --git a/roles/prometheus/defaults/main.yml b/roles/prometheus/defaults/main.yml
index cd91dee6..61c383ed 100644
--- a/roles/prometheus/defaults/main.yml
+++ b/roles/prometheus/defaults/main.yml
@@ -9,3 +9,4 @@ prometheus_targets:
prometheus_node_exporter_targets: []
prometheus_hostname: "metrics.home.arpa"
+prometheus_extra_scrape_configs: []
diff --git a/roles/prometheus/meta/argument_specs.yml b/roles/prometheus/meta/argument_specs.yml
index 5f908119..11beae38 100644
--- a/roles/prometheus/meta/argument_specs.yml
+++ b/roles/prometheus/meta/argument_specs.yml
@@ -32,3 +32,8 @@ argument_specs:
type: "str"
description: "FQDN for the prometheus nginx vhost (e.g. 'metrics.home.arpa')."
default: "metrics.home.arpa"
+ prometheus_extra_scrape_configs:
+ description: "Additional Prometheus scrape jobs"
+ type: "list"
+ elements: "dict"
+ default: []
diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2
index c43864ea..f7f2ae24 100644
--- a/roles/prometheus/templates/prometheus.yml.j2
+++ b/roles/prometheus/templates/prometheus.yml.j2
@@ -15,3 +15,11 @@ scrape_configs:
- targets: {{ prometheus_node_exporter_targets | to_yaml }}
scrape_interval: {{ prometheus_scrape_interval }}
metrics_path: /metrics
+{% for job in prometheus_extra_scrape_configs %}
+
+ - job_name: '{{ job.name }}'
+ static_configs:
+ - targets: {{ job.targets | to_yaml }}
+ scrape_interval: {{ job.scrape_interval | default(prometheus_scrape_interval) }}
+ metrics_path: {{ job.metrics_path | default('/metrics') }}
+{% endfor %}