Files
gitlab-mirror/roles/smartctl_exporter/templates/smartctl_exporter.service.j2
2025-12-16 11:56:52 +03:00

46 lines
1.8 KiB
Django/Jinja

[Unit]
Description=Smartctl Exporter
Documentation=https://github.com/prometheus-community/smartctl_exporter
After=network.target
StartLimitIntervalSec=120
StartLimitBurst=5
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/smartctl_exporter \
--web.listen-address={{ smartctl_exporter_web_listen_address }} \
--smartctl.interval={{ smartctl_exporter_interval }} \
--smartctl.rescan={{ smartctl_exporter_rescan }} \
{% if smartctl_exporter_devices is defined and smartctl_exporter_devices | length > 0 %}
{% for device in smartctl_exporter_devices %}
--smartctl.device={{ device }} \
{% endfor %}
{% endif %}
--smartctl.device-exclude={{ smartctl_exporter_device_exclude }} \
--smartctl.device-include={{ smartctl_exporter_device_include }} \
--web.telemetry-path={{ smartctl_exporter_web_telemetry_path }} \
--log.level={{ smartctl_exporter_log_level }} \
--log.format={{ smartctl_exporter_log_format }} \
{% if smartctl_exporter_args is defined and smartctl_exporter_args | length > 0 %}
{{ smartctl_exporter_args }} \
{% endif %}
{% if smartctl_exp_source_web_config_dir is defined and smartctl_exp_source_web_config_dir | length > 0 %} \
--web.config.file={{ smartctl_exporter_web_config_dir }}/web_smartctl.conf
{% endif %}
SyslogIdentifier=smartctl_exporter
Restart=on-failure
RestartSec=5
ProtectHome=yes
NoNewPrivileges=yes
ProtectSystem=strict
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=yes
ProtectSystem=full
[Install]
WantedBy=multi-user.target