diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-09-26 04:29:02 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-09-26 04:29:02 +0200 |
commit | 223297c29d78e4fe95e2ed2338455708e4e0a9c3 (patch) | |
tree | 02534f529becf59835dd1ed5dee0f2321966a09b /roles/monitoring/prometheus/exporter/node/tasks | |
parent | switch to pascal for pressure (diff) | |
parent | fix alert wording (diff) |
Merge branch 'topic/prometheus-refactoring'
Diffstat (limited to 'roles/monitoring/prometheus/exporter/node/tasks')
-rw-r--r-- | roles/monitoring/prometheus/exporter/node/tasks/main.yml | 32 | ||||
-rw-r--r-- | roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_script.yml | 24 |
2 files changed, 50 insertions, 6 deletions
diff --git a/roles/monitoring/prometheus/exporter/node/tasks/main.yml b/roles/monitoring/prometheus/exporter/node/tasks/main.yml index 8392e580..2811c759 100644 --- a/roles/monitoring/prometheus/exporter/node/tasks/main.yml +++ b/roles/monitoring/prometheus/exporter/node/tasks/main.yml @@ -1,7 +1,10 @@ --- + ## TODO: pin version - name: install apt packages apt: - name: prom-exporter-node + name: + - prom-exporter-node + - moreutils state: present - name: create directory for textfile collector @@ -25,8 +28,25 @@ - name: register exporter copy: content: | - method: http - http: - port: 9100 - dest: /etc/prometheus/exporter/enabled/node.yml - notify: reload prometheus-exporter-exporter + location = /node { + proxy_pass http://127.0.0.1:9100/metrics; + } + dest: /etc/prometheus/exporter/node.locations + notify: reload nginx + +- name: create directory for textfile collector scripts + file: + path: /usr/local/share/prometheus-node-exporter + state: directory + +- name: install the apt textfile collector script + when: ansible_pkg_mgr == "apt" + vars: + textfile_collector_name: "apt" + include_tasks: textfile_collector_script.yml + +- name: install all other textfile collector scripts + loop: "{{ prometheus_exporter_node_textfile_collector_scripts }}" + loop_control: + loop_var: textfile_collector_name + include_tasks: textfile_collector_script.yml diff --git a/roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_script.yml b/roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_script.yml new file mode 100644 index 00000000..80390a15 --- /dev/null +++ b/roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_script.yml @@ -0,0 +1,24 @@ +--- +- name: install the collector script + copy: + src: "{{ textfile_collector_name }}" + dest: "/usr/local/share/prometheus-node-exporter/{{ textfile_collector_name }}" + mode: 0755 + +- name: install systemd service units + loop: + - service + - timer + template: + src: "textfile-collector-scripts/{{ textfile_collector_name }}.{{ item }}.j2" + dest: "/etc/systemd/system/prometheus-node-exporter_{{ textfile_collector_name }}.{{ item }}" + +- name: make sure the systemd timer is enabled and started + systemd: + daemon_reload: yes + name: "prometheus-node-exporter_{{ textfile_collector_name }}.timer" + state: started + enabled: yes + + +## TODO: install deps for textfile collectors: i.e. smartmontools for collector smartmon |