Make prometheus-node-exporter a bit more capable

By running it in a more privileged container with access to the host network stack and such
This commit is contained in:
Peetz0r 2021-01-29 12:23:59 +01:00
parent a10e3244d9
commit 76d7e84be5
2 changed files with 6 additions and 3 deletions

View File

@ -21,14 +21,17 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-prometheus-nod
--log-driver=none \ --log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \ --cap-drop=ALL \
--network={{ matrix_docker_network }} \
{% if matrix_prometheus_node_exporter_container_http_host_bind_port %} {% if matrix_prometheus_node_exporter_container_http_host_bind_port %}
-p {{ matrix_prometheus_node_exporter_container_http_host_bind_port }}:9100 \ -p {{ matrix_prometheus_node_exporter_container_http_host_bind_port }}:9100 \
{% endif %} {% endif %}
{% for arg in matrix_prometheus_node_exporter_container_extra_arguments %} {% for arg in matrix_prometheus_node_exporter_container_extra_arguments %}
{{ arg }} \ {{ arg }} \
{% endfor %} {% endfor %}
{{ matrix_prometheus_node_exporter_docker_image }} --net="host" \
--pid="host" \
-v "/:/host:ro,rslave" \
{{ matrix_prometheus_node_exporter_docker_image }} \
--path.rootfs=/host
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-prometheus-node-exporter 2>/dev/null' ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-prometheus-node-exporter 2>/dev/null'
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-prometheus-node-exporter 2>/dev/null' ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-prometheus-node-exporter 2>/dev/null'

View File

@ -36,5 +36,5 @@ scrape_configs:
{% if matrix_prometheus_node_exporter_enabled %} {% if matrix_prometheus_node_exporter_enabled %}
- job_name: node - job_name: node
static_configs: static_configs:
- targets: ['matrix-prometheus-node-exporter:9100'] - targets: ['172.18.0.1:9100']
{% endif %} {% endif %}