2023-03-09 01:20:32 +00:00
|
|
|
{{ 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 %}
|
2023-08-26 08:29:12 +00:00
|
|
|
{% if systemd_exporter_version is version('0.5.0', '>=') %}
|
2023-07-26 13:26:04 +00:00
|
|
|
--systemd.collector.enable-restart-count \
|
2023-08-26 08:29:12 +00:00
|
|
|
{% else %}
|
|
|
|
--collector.enable-restart-count \
|
|
|
|
{% endif %}
|
2023-03-09 01:20:32 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if systemd_exporter_enable_file_descriptor_size %}
|
2023-08-26 08:29:12 +00:00
|
|
|
{% if systemd_exporter_version is version('0.5.0', '>=') %}
|
2023-07-26 13:26:04 +00:00
|
|
|
--systemd.collector.enable-file-descriptor-size \
|
2023-08-26 08:29:12 +00:00
|
|
|
{% else %}
|
|
|
|
--collector.enable-file-descriptor-size \
|
|
|
|
{% endif %}
|
2023-03-09 01:20:32 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if systemd_exporter_enable_ip_accounting %}
|
2023-08-26 08:29:12 +00:00
|
|
|
{% if systemd_exporter_version is version('0.5.0', '>=') %}
|
2023-07-26 13:26:04 +00:00
|
|
|
--systemd.collector.enable-ip-accounting \
|
2023-08-26 08:29:12 +00:00
|
|
|
{% else %}
|
|
|
|
--collector.enable-ip-accounting \
|
|
|
|
{% endif %}
|
2023-03-09 01:20:32 +00:00
|
|
|
{% endif %}
|
2023-07-26 13:26:04 +00:00
|
|
|
{% if systemd_exporter_unit_include != ""%}
|
|
|
|
--systemd.collector.unit-include={{ systemd_exporter_unit_include }} \
|
2023-03-09 01:20:32 +00:00
|
|
|
{% endif %}
|
2023-07-26 13:26:04 +00:00
|
|
|
{% if systemd_exporter_unit_exclude != "" %}
|
|
|
|
--systemd.collector.unit-exclude={{ systemd_exporter_unit_exclude }} \
|
2023-08-22 18:24:44 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if systemd_exporter_tls_server_config | length > 0 %}
|
|
|
|
--web.config.file=/etc/systemd_exporter/config.yaml \
|
2023-03-09 01:20:32 +00:00
|
|
|
{% endif %}
|
2023-08-26 08:39:35 +00:00
|
|
|
--log.level={{ systemd_exporter_log_level }} \
|
2023-03-09 01:20:32 +00:00
|
|
|
--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
|