-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnode_exporter.yml
116 lines (104 loc) · 3.48 KB
/
node_exporter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
- hosts: homelab
vars:
application: node_exporter
docker_network: "{{ networks.pub }}"
tasks:
- name: Create config folder
ansible.builtin.file:
path: "{{ config_directory }}"
state: directory
owner: "{{ common_user }}"
group: "{{ common_group }}"
mode: "0771"
- name: Create scripts folder
ansible.builtin.file:
path: "{{ config_directory }}/textfile-collector-scripts"
state: directory
owner: "{{ common_root_id }}"
group: "{{ common_root_group }}"
mode: "0775"
register: _scripts_dir
- name: Install prometheus_client python package
ansible.builtin.apt:
name: python3-prometheus-client
- name: Clone node-exporter-textfile-collector-scripts repo
ansible.builtin.git:
repo: https://github.com/prometheus-community/node-exporter-textfile-collector-scripts.git
dest: "{{ _scripts_dir.path }}"
update: true
single_branch: true
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 86400
changed_when: false
- name: Install collector packages
ansible.builtin.apt:
name:
- moreutils
- ipmitool
- smartmontools
state: present
- name: Create textfile folder
ansible.builtin.file:
path: "{{ config_directory }}/textfiles"
state: directory
owner: "{{ common_user }}"
group: "{{ common_group }}"
mode: "0775"
register: _textfiles_folder
- name: Create textfile collector cronjobs
ansible.builtin.cron:
name: "{{ item.name }}"
minute: "*/1"
job: "({{ item.job }} | sponge {{ _textfiles_folder.path }}/{{ item.name }}.prom) && chmod 644 {{ _textfiles_folder.path }}/{{ item.name }}.prom"
loop:
-
name: smartmon
job: "PATH=$PATH:/usr/sbin/ {{ _scripts_dir.path }}/smartmon.py"
-
name: apt
job: "{{ _scripts_dir.path }}/apt_info.py"
-
name: ipmitool
job: "ipmitool sensor | {{ _scripts_dir.path }}/ipmitool"
- name: Create container
ansible.builtin.include_role:
name: docker_container
vars:
image: quay.io/prometheus/node-exporter:v1.8.2
command:
- "--path.rootfs=/host"
- "--collector.mountstats"
- "--collector.filesystem.fs-types-exclude=^(tmpfs|vfat|rpc_pipefs|fuse.lxcfs|rootfs|squashfs|nsfs)$"
- "--collector.textfile.directory=/textfiles"
- "--no-collector.arp"
- "--no-collector.bcache"
- "--no-collector.bonding"
- "--no-collector.conntrack"
- "--no-collector.cpufreq"
- "--no-collector.edac"
- "--no-collector.entropy"
- "--no-collector.filefd"
- "--no-collector.infiniband"
- "--no-collector.ipvs"
- "--no-collector.netclass"
- "--no-collector.netdev"
- "--no-collector.netstat"
- "--no-collector.nfsd"
- "--no-collector.pressure"
- "--no-collector.sockstat"
- "--no-collector.stat"
- "--no-collector.vmstat"
- "--no-collector.xfs"
pid_mode: host
capabilities:
- SYS_TIME
volumes:
- "/:/host:ro,rslave"
- "{{ _textfiles_folder.path }}:/textfiles"
comparisons:
labels: allow_more_present
metrics:
- port: 9100