src.nth.io/

summaryrefslogtreecommitdiff
path: root/prometheus/rpi-client
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2020-05-13 10:10:07 -0500
committerLuke Hoersten <[email protected]>2020-05-13 10:10:07 -0500
commit2eaa8b2abf99911340b2a426044d016a1fd6a514 (patch)
tree7386088f94cf56bc314487bff7b3712218bdb7e9 /prometheus/rpi-client
parent2053a218439b0afb8aa06947a3ad88572dfd9107 (diff)
Fixed gpu collector on rpi.
Diffstat (limited to 'prometheus/rpi-client')
-rw-r--r--prometheus/rpi-client/defaults/main.yaml2
-rw-r--r--prometheus/rpi-client/handlers/main.yaml5
-rw-r--r--prometheus/rpi-client/tasks/main.yaml8
3 files changed, 14 insertions, 1 deletions
diff --git a/prometheus/rpi-client/defaults/main.yaml b/prometheus/rpi-client/defaults/main.yaml
index 11cbc5c..6ef5b84 100644
--- a/prometheus/rpi-client/defaults/main.yaml
+++ b/prometheus/rpi-client/defaults/main.yaml
@@ -5,3 +5,5 @@ prometheus_client_arch: "{{ansible_architecture}}"
prometheus_client_rpi_src: "https://github.com/lukasmalkmus/rpi_exporter/releases/download/v{{prometheus_client_rpi_exporter_version}}/rpi_exporter-{{prometheus_client_rpi_exporter_version}}.linux-{{prometheus_client_arch}}.tar.gz"
prometheus_client_rpi_dest: "rpi_exporter-{{prometheus_client_rpi_exporter_version}}.linux-{{prometheus_client_arch}}"
+
+prometheus_client_rpi_collect_gpu_temp: true
diff --git a/prometheus/rpi-client/handlers/main.yaml b/prometheus/rpi-client/handlers/main.yaml
new file mode 100644
index 0000000..7740ce7
--- /dev/null
+++ b/prometheus/rpi-client/handlers/main.yaml
@@ -0,0 +1,5 @@
+---
+
+- name: restart rpi_exporter
+ systemd: name="rpi_exporter.service" state="restarted" daemon_reload="yes"
+ become: yes
diff --git a/prometheus/rpi-client/tasks/main.yaml b/prometheus/rpi-client/tasks/main.yaml
index 05102f6..f2dded9 100644
--- a/prometheus/rpi-client/tasks/main.yaml
+++ b/prometheus/rpi-client/tasks/main.yaml
@@ -9,6 +9,7 @@
src: "{{prometheus_client_rpi_src}}"
remote_src: yes
dest: "/tmp/"
+ notify: restart rpi_exporter
- name: install systemd service for rpi-exporter
become: yes
@@ -16,13 +17,17 @@
src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
remote_src: yes
dest: "/lib/systemd/system/rpi_exporter.service"
+ notify: restart rpi_exporter
- name: disable GPU temp scraping
become: yes
lineinfile:
path: "/lib/systemd/system/rpi_exporter.service"
regexp: "^ExecStart=/usr/local/bin/rpi_exporter"
- line: "ExecStart=/usr/local/bin/rpi_exporter --collector.gpu=false"
+ line: "ExecStart=/usr/local/bin/rpi_exporter --no-collector.gpu"
+ when: not prometheus_client_rpi_collect_gpu_temp
+ notify: restart rpi_exporter
+
- name: install rpi-exporter binary
become: yes
@@ -31,6 +36,7 @@
remote_src: yes
dest: "/usr/local/bin/rpi_exporter"
mode: "0755"
+ notify: restart rpi_exporter
- name: ensure systemd service is started
become: yes