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

Commit 0373b75

Browse files
authored
Add support for textfile collector (#42)
[feature] Create a default textfile collector directory and enable it by default.
1 parent 60570b3 commit 0373b75

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
node_exporter_version: 0.16.0
33
node_exporter_web_listen_address: "0.0.0.0:9100"
44

5+
node_exporter_textfile_dir: "/var/lib/node_exporter"
6+
57
node_exporter_enabled_collectors:
68
- systemd
9+
- textfile:
10+
directory: "{{ node_exporter_textfile_dir }}"
711
# - filesystem:
812
# ignored-mount-points: "^/(sys|proc|dev)($|/)"
913
# ignored-fs-types: "^(sys|proc|auto)fs$"

molecule/default/tests/test_default.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
66

77

8+
def test_directories(host):
9+
dirs = [
10+
"/var/lib/node_exporter"
11+
]
12+
for dir in dirs:
13+
d = host.file(dir)
14+
assert d.is_directory
15+
assert d.exists
16+
17+
818
def test_files(host):
919
files = [
1020
"/etc/systemd/system/node_exporter.service",

tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@
5050
- restart node exporter
5151
when: not ansible_check_mode
5252

53+
- name: Create texfile collector dir
54+
file:
55+
path: "{{ node_exporter_textfile_dir }}"
56+
state: directory
57+
owner: "node-exp"
58+
group: "node-exp"
59+
recurse: true
60+
mode: 0755
61+
when: node_exporter_textfile_dir != ""
62+
5363
- name: Install libcap on Debian systems
5464
package:
5565
name: "libcap2-bin"

0 commit comments

Comments
 (0)