ansible-collection-prometheus/roles/systemd_exporter/templates/systemd_exporter.service.j2
jmills 9f9bd6830f
Fix: systemd_exporter - rename collector flags (#167)
* Fix systemd_exporter vars to match the exporter flags

---------

Signed-off-by: Jeremy Miller <runofthemill@users.noreply.github.com>
Signed-off-by: prombot <prometheus-team@googlegroups.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: prombot <prometheus-team@googlegroups.com>
Co-authored-by: SuperQ <SuperQ@users.noreply.github.com>
2023-07-26 15:26:04 +02:00

47 lines
1.3 KiB
Django/Jinja

{{ ansible_managed | comment }}
[Unit]
Description=Prometheus SystemD Exporter
After=network-online.target
[Service]
Type=simple
User={{ systemd_exporter_system_user }}
Group={{ systemd_exporter_system_group }}
ExecStart={{ systemd_exporter_binary_install_dir }}/systemd_exporter \
{% if systemd_exporter_enable_restart_count %}
--systemd.collector.enable-restart-count \
{% endif %}
{% if systemd_exporter_enable_file_descriptor_size %}
--systemd.collector.enable-file-descriptor-size \
{% endif %}
{% if systemd_exporter_enable_ip_accounting %}
--systemd.collector.enable-ip-accounting \
{% endif %}
{% if systemd_exporter_unit_include != ""%}
--systemd.collector.unit-include={{ systemd_exporter_unit_include }} \
{% endif %}
{% if systemd_exporter_unit_exclude != "" %}
--systemd.collector.unit-exclude={{ systemd_exporter_unit_exclude }} \
{% endif %}
--web.listen-address={{ systemd_exporter_web_listen_address }}
SyslogIdentifier=systemd_exporter
Restart=always
RestartSec=1
StartLimitInterval=0
ProtectHome=yes
NoNewPrivileges=yes
{% if (ansible_facts.packages.systemd | first).version is version('232', '>=') %}
ProtectSystem=strict
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=yes
{% else %}
ProtectSystem=full
{% endif %}
[Install]
WantedBy=multi-user.target