summaryrefslogtreecommitdiff
path: root/data/templates/prometheus/node_exporter.service.j2
blob: ef2f709b6c93e9b1a5c00a7c84a29fca306f84d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{% set vrf_command = 'ip vrf exec ' ~ vrf ~ ' runuser -u node_exporter -- ' if vrf is vyos_defined else '' %}
[Unit]
Description=Node Exporter
Documentation=https://github.com/prometheus/node_exporter
After=network.target

[Service]
{% if vrf is not vyos_defined %}
User=node_exporter
{% endif %}
ExecStart={{ vrf_command }}/usr/sbin/node_exporter \
{% if collectors is vyos_defined %}
{%     if collectors.textfile is vyos_defined %}
        --collector.textfile.directory=/run/node_exporter/collector \
{%     endif %}
{% endif %}
{% if listen_address is vyos_defined %}
{%     for address in listen_address %}
        --web.listen-address={{ address | bracketize_ipv6 }}:{{ port }}
{%     endfor %}
{% else %}
        --web.listen-address=:{{ port }}
{% endif %}

[Install]
WantedBy=multi-user.target