Skip to content

Commit e952d05

Browse files
gajowipaulfantom
authored andcommitted
explain naming
fix config file extension fix config file extension make config file readable add non-trivial process_exporter_names default fix link to default settings fix typo meet Yamllint check for indenting style avoid interpreting process-exporter Template variables by using literal and raw attempt to remove trailing space remove comment trailing space explain unusual process_exporter_names setup
1 parent ab4e5dc commit e952d05

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
2525
| `process_exporter_version` | 0.5.0 | Process exporter package version. Also accepts latest as parameter |
2626
| `process_exporter_web_listen_address` | "0.0.0.0:9256" | Address on which process_exporter will listen |
2727
| `process_exporter_config_dir` | "/etc/process_exporter" | Path to directory with process_exporter configuration |
28-
| `process_exporter_names` | [] | Processes which should be monitored. Syntax is the same as in https://github.com/ncabatoff/process-exporter#using-a-config-file |
28+
| `process_exporter_names` | [see: defaults/main.yml](defaults/main.yml#L8) | Processes which should be monitored. Syntax is the same as in https://github.com/ncabatoff/process-exporter#using-a-config-file Default is consistent with deb/rpm packages.|
29+
30+
`process_exporter_names` handling has been set up in an unusual way to handle recommended process-exporter 'Template variables' (such as {{.Comm}}). Follow the example in [defaults/main.yml](defaults/main.yml) if you want to define custom filtering/grouping of processes that use Template variables and make sure to keep the {% raw %} block delimiters.
2931

3032
## Example
3133

defaults/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ process_exporter_web_listen_address: "0.0.0.0:9256"
66
process_exporter_config_dir: '/etc/process_exporter'
77

88
# Process names
9-
process_exporter_names: []
9+
# "raw" section is needed to avoid attempted interpretation
10+
# of process-exporter Template varables (like {{.Comm}})
11+
process_exporter_names: |
12+
{% raw %}
13+
- name: "{{.Comm}}"
14+
cmdline:
15+
- '.+'
16+
{% endraw %}

tasks/configure.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
dest: "{{ process_exporter_config_dir }}/config.yml"
1414
content: |
1515
process_names:
16-
{{ process_exporter_names | to_nice_yaml }}
16+
{{ process_exporter_names }}
1717
backup: false
1818
owner: root
19-
mode: 0640
19+
mode: 0644
2020
when:
2121
- process_exporter_names != []
2222

templates/process_exporter.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ User={{ process_exporter_system_user }}
1111
Group={{ process_exporter_system_group }}
1212
ExecStart=/usr/local/bin/process_exporter \
1313
{% if process_exporter_names != [] -%}
14-
--config.path {{ process_exporter_config_dir }}/config.yaml \
14+
--config.path {{ process_exporter_config_dir }}/config.yml \
1515
{% endif -%}
1616
--web.listen-address={{ process_exporter_web_listen_address }}
1717

0 commit comments

Comments
 (0)