Install node_exporter to enable monitoring

This commit is contained in:
Markus 2018-07-12 10:35:15 +02:00
parent dc0c97b29f
commit b44e9dc450
7 changed files with 42 additions and 5 deletions

6
hosts
View File

@ -3,8 +3,4 @@ gw11.regensburg.freifunk.net
gw21.regensburg.freifunk.net
gw31.regensburg.freifunk.net
confluence.regensburg.freifunk.net
[gw]
gw11.regensburg.freifunk.net
gw21.regensburg.freifunk.net
gw31.regensburg.freifunk.net
unms.ffrgb ansible_host=10.90.224.101

View File

@ -0,0 +1,4 @@
---
node_exporter_version: 0.16.0
node_exporter_url: https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-amd64.tar.gz

View File

@ -0,0 +1 @@
OPTIONS=""

View File

@ -0,0 +1,6 @@
---
- name: Restart node_exporter
service: name=node_exporter state=restarted
- name: Reload systemd
command: systemctl daemon-reload

View File

@ -0,0 +1,19 @@
---
- name: Create user
user: name=node_exporter
- name: Unpack node_exporter
unarchive: src="{{ node_exporter_url }}" remote_src=yes dest=/opt/ creates=/opt/node_exporter-{{ node_exporter_version }}.linux-amd64/node_exporter
- name: Configure node_exporter
copy: src=node_exporter dest=/etc/default/node_exporter
- name: Install systemd unit
template: src=node_exporter.service.j2 dest=/lib/systemd/system/node_exporter.service
notify:
- Reload systemd
- Restart node_exporter
- name: Enable node_exporter
service: name=node_exporter enabled=yes

View File

@ -0,0 +1,10 @@
[Unit]
Description=Node Exporter
[Service]
User=node_exporter
EnvironmentFile=/etc/default/node_exporter
ExecStart=/opt/node_exporter-{{ node_exporter_version }}.linux-amd64/node_exporter $OPTIONS
[Install]
WantedBy=multi-user.target

View File

@ -6,6 +6,7 @@
- common
- apt
- ntp
- node_exporter
- name: Setup gateway servers
hosts: [gw11.regensburg.freifunk.net, gw21.regensburg.freifunk.net, gw31.regensburg.freifunk.net]