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

Commit

Permalink
Add support for textfile collector
Browse files Browse the repository at this point in the history
[feature]

Create a default textfile collector directory and enable it by default.
  • Loading branch information
SuperQ committed Jun 10, 2018
1 parent 60570b3 commit dd54aef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
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: "/opt/node_exporter/textfile"

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
9 changes: 9 additions & 0 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')


def test_directories(host, dirs):
dirs = [
"/opt/node_exporter/textfile"
]
d = host.file(dirs)
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 is defined

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

0 comments on commit dd54aef

Please sign in to comment.