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

Add support for textfile collector #42

Merged
merged 1 commit into from
Jun 10, 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
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
node_exporter_version: 0.16.0
node_exporter_web_listen_address: "0.0.0.0:9100"

node_exporter_textfile_dir: "/var/lib/node_exporter"

node_exporter_enabled_collectors:
- systemd
- textfile:
directory: "{{ node_exporter_textfile_dir }}"
# - filesystem:
# ignored-mount-points: "^/(sys|proc|dev)($|/)"
# ignored-fs-types: "^(sys|proc|auto)fs$"
Expand Down
10 changes: 10 additions & 0 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')


def test_directories(host):
dirs = [
"/var/lib/node_exporter"
]
for dir in dirs:
d = host.file(dir)
assert d.is_directory
assert d.exists


def test_files(host):
files = [
"/etc/systemd/system/node_exporter.service",
Expand Down
10 changes: 10 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@
- restart node exporter
when: not ansible_check_mode

- name: Create texfile collector dir
file:
path: "{{ node_exporter_textfile_dir }}"
state: directory
owner: "node-exp"
group: "node-exp"
recurse: true
mode: 0755
when: node_exporter_textfile_dir != ""

- name: Install libcap on Debian systems
package:
name: "libcap2-bin"
Expand Down