ansible-collection-prometheus/roles/snmp_exporter/templates/snmp_exporter.service.j2
gardar 1173d1ada7
refactor(snmp_exporter): delegate common tasks to _common role
Signed-off-by: gardar <gardar@users.noreply.github.com>
2024-10-15 17:13:47 +00:00

32 lines
940 B
Django/Jinja

[Unit]
Description=Prometheus SNMP Exporter
After=network-online.target
StartLimitInterval=0
[Service]
Type=simple
User=nobody
Group={{ 'nogroup' if ansible_os_family == 'Debian' else 'nobody' }}
ExecReload=/bin/kill -HUP $MAINPID
ExecStart={{ snmp_exporter_binary_install_dir }}/snmp_exporter \
{% if snmp_exporter_version is version('0.21.0', '>=') and
snmp_exporter_web_listen_address is iterable and
snmp_exporter_web_listen_address is not mapping and
snmp_exporter_web_listen_address is not string %}
{% for address in snmp_exporter_web_listen_address %}
--web.listen-address={{ address }} \
{% endfor %}
{% else %}
--web.listen-address={{ snmp_exporter_web_listen_address }} \
{% endif %}
--log.level={{ snmp_exporter_log_level }} \
--config.file={{ snmp_exporter_config_dir }}/snmp.yml
KillMode=process
SyslogIdentifier=snmp_exporter
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target