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 (#42)
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 authored Jun 10, 2018
1 parent 60570b3 commit 0373b75
Show file tree
Hide file tree
Showing 3 changed files with 24 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: "/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

0 comments on commit 0373b75

Please sign in to comment.