ansible-collection-prometheus/roles/snmp_exporter/templates/snmp_exporter.service.j2
Christian Krause 54d857d41b
enhancement(snmp_exporter): allows using multiple web listen addresses
Signed-off-by: Christian Krause <christian.krause@idiv.de>
2023-11-28 13:07:31 +01:00

32 lines
904 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=/usr/local/bin/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=/etc/snmp_exporter/snmp.yml
KillMode=process
SyslogIdentifier=snmp_exporter
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target