From edfbe73fc195ba687af065540390cc84ee40f767 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Mon, 17 Jun 2019 12:41:54 +0000 Subject: [PATCH] [monitoring] add node_exporter --- playbook.yml | 1 + roles/monitoring/handlers/main.yml | 5 +++++ roles/monitoring/tasks/main.yml | 7 +++++++ roles/monitoring/tasks/node_exporter.yml | 12 ++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 roles/monitoring/handlers/main.yml create mode 100644 roles/monitoring/tasks/main.yml create mode 100644 roles/monitoring/tasks/node_exporter.yml diff --git a/playbook.yml b/playbook.yml index e75f13c..287b14a 100644 --- a/playbook.yml +++ b/playbook.yml @@ -18,3 +18,4 @@ tags: - docker - role: wireguard + - role: monitoring diff --git a/roles/monitoring/handlers/main.yml b/roles/monitoring/handlers/main.yml new file mode 100644 index 0000000..9b3fc5e --- /dev/null +++ b/roles/monitoring/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart-node-exporter + systemd: + name: prometheus-node-exporter + state: restarted diff --git a/roles/monitoring/tasks/main.yml b/roles/monitoring/tasks/main.yml new file mode 100644 index 0000000..01c4de7 --- /dev/null +++ b/roles/monitoring/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- block: + - import_tasks: node_exporter.yml + tags: + - monitoring:node_exporter + tags: + - monitoring diff --git a/roles/monitoring/tasks/node_exporter.yml b/roles/monitoring/tasks/node_exporter.yml new file mode 100644 index 0000000..c3f8ede --- /dev/null +++ b/roles/monitoring/tasks/node_exporter.yml @@ -0,0 +1,12 @@ +--- +- name: install prometheus node exporter + apt: + name: prometheus-node-exporter + state: present + +- name: set node exporter config + lineinfile: + path: /etc/default/prometheus-node-exporter + regexp: '^ARGS=' + line: ARGS="--web.listen-address=10.80.0.2:9100" + notify: restart-node-exporter