Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

fedora support + issue 18 #24

Merged
merged 3 commits into from
Feb 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,10 @@ node_exporter_version: 0.15.2
node_exporter_web_listen_address: "0.0.0.0:9100"

node_exporter_enabled_collectors:
- conntrack
- diskstats
- entropy
- filefd
- filesystem
- hwmon
- loadavg
- mdadm
- meminfo
- netdev
- netstat
- stat
- textfile
- time
- vmstat
- filesystem:
ignored-mount-points: "^/(sys|proc|dev)($|/)"
ignored-fs-types: "^(sys|proc|auto)fs$"
- systemd
- timex

node_exporter_disabled_collectors:
- logind
Expand Down
7 changes: 3 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- name: Propagate Node Exporter binaries
copy:
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/node_exporter"
dest: "/opt/node_exporter"
dest: "/usr/local/bin/node_exporter"
mode: 0750
owner: "node-exp"
group: "node-exp"
Expand All @@ -44,7 +44,7 @@

- name: Node exporter can read anything (omit file permissions)
capabilities:
path: '/opt/node_exporter'
path: '/usr/local/bin/node_exporter'
capability: cap_dac_read_search+ep
state: present

Expand All @@ -59,15 +59,14 @@
- restart node exporter

- name: Install dependencies on RedHat OS family
yum:
package:
name: "{{ item }}"
state: present
with_items:
- libselinux-python
- policycoreutils-python
when:
- ansible_os_family == "RedHat"
- ansible_virtualization_type != "docker"

- name: Allow Node Exporter port in SELinux on RedHat OS family
seport:
Expand Down
16 changes: 15 additions & 1 deletion templates/node_exporter.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@ Type=simple
User=node-exp
Group=node-exp
Nice=-5
ExecStart=/opt/node_exporter --web.listen-address {{ node_exporter_web_listen_address }} {% for c in node_exporter_enabled_collectors %} --collector.{{ c }}{% endfor %} {% for c in node_exporter_disabled_collectors %} --no-collector.{{ c }}{% endfor %}
ExecStart=/usr/local/bin/node_exporter \
--web.listen-address {{ node_exporter_web_listen_address }} \
{% for c in node_exporter_enabled_collectors -%}
{% if not c is mapping -%}
--collector.{{ c }} \
{% else -%}
{% set name,opt = c.items()[0] -%}
{% for k,v in opt.items() -%}
--collector.{{ name }}.{{ k }}={{ v }} \
{% endfor -%}
{% endif -%}
{% endfor -%}
{% for c in node_exporter_disabled_collectors -%}
--no-collector.{{ c }} \
{% endfor %}

SyslogIdentifier=node_exporter
Restart=always
Expand Down
2 changes: 1 addition & 1 deletion tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def test_files(host):
files = [
"/etc/systemd/system/node_exporter.service",
"/opt/node_exporter"
"/usr/local/bin/node_exporter"
]
for file in files:
f = host.file(file)
Expand Down