diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-09-24 00:57:01 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-09-24 00:57:01 +0200 |
commit | 6320da1262c1f44ac773c6b6578a59ba286ce973 (patch) | |
tree | 45cdb61f249f502727fd500d7c4760cae9a46133 /roles/monitoring/prometheus/exporter/node/tasks/main.yml | |
parent | add some more prometheus rules for blackbox exporter (diff) |
add some basic prometheus node exporter textfile collector scripts
Diffstat (limited to 'roles/monitoring/prometheus/exporter/node/tasks/main.yml')
-rw-r--r-- | roles/monitoring/prometheus/exporter/node/tasks/main.yml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/roles/monitoring/prometheus/exporter/node/tasks/main.yml b/roles/monitoring/prometheus/exporter/node/tasks/main.yml index 3fa0a1ec..61e385f7 100644 --- a/roles/monitoring/prometheus/exporter/node/tasks/main.yml +++ b/roles/monitoring/prometheus/exporter/node/tasks/main.yml @@ -31,3 +31,38 @@ port: 9100 dest: /etc/prometheus/exporter/exporter/node.yml notify: reload prometheus-exporter-exporter + +- name: create directory for textfile collector scripts + file: + path: /usr/local/lib/prometheus-node-exporter + state: directory + +- name: install textfile collector script wrapper + copy: + content: | + #!/bin/bash + + if [ -z "$1" ]; then + echo "Please specify which collector script to call!" + exit 1 + fi + collector="$1" + + set -e + rm -f "/var/lib/prometheus-node-exporter/textfile-collector/$collector.prom".* + "/usr/local/lib/prometheus-node-exporter/$collector" > "/var/lib/prometheus-node-exporter/textfile-collector/$collector.prom.$$" + mv "/var/lib/prometheus-node-exporter/textfile-collector/$collector.prom.$$" "/var/lib/prometheus-node-exporter/textfile-collector/$collector.prom" + dest: /usr/local/lib/prometheus-node-exporter/run-collector + mode: 0755 + +- 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 |