Skip to content

homecentr/docker-prometheus-node-exporter

Repository files navigation

Project status

CI/CD on master Regular Docker image vulnerability scan

HomeCentr - prometheus-node-exporter

This Docker image is a repack of the original Prometheus Node exporter with the usual Homecentr bells and whistles.

Usage

version: "3.7"
services:
  exporter:
    build: .
    image: homecentr/prometheus-node-exporter
    restart: unless-stopped
    environment:
      NODE_ID: "myserver"
      NODE_EXPORTER_ARGS: "--path.sysfs=/host/sys --path.procfs=/host/proc --collector.textfile.directory=/etc/node-exporter/ --collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/) --no-collector.ipvs"
    ports:
      - 9100:9100
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
      - /etc/hostname:/etc/nodename

Environment variables

Name Default value Description
PUID 7077 UID of the user prometheus-node-exporter should be running as.
PGID 7077 GID of the user prometheus-node-exporter should be running as.
NODE_ID Name of the node which should be used as metrics label
NODE_EXPORTER_ARGS Additional command line arguments passed to the Node exporter executable. Please check the documentation in the original project.

Exposed ports

Port Protocol Description
9100 TCP Metrics served over HTTP by the Node exporter

Volumes

This container does not expose any explicit volumes, but for correct function, you need to mount the host's /proc, /sys/ and / so the exporter can evaluate the host's state a report it in the metrics. These directories can be mounted pretty much anywhere, you just need to specify the same path in the NODE_EXPORTER_ARGS variable as shown in the example above.

Security

The container is regularly scanned for vulnerabilities and updated. Further info can be found in the Security tab.

Container user

The container supports privilege drop. Even though the container starts as root, it will use the permissions only to perform the initial set up. The prometheus-node-exporter process runs as UID/GID provided in the PUID and PGID environment variables.

⚠️ Do not change the container user directly using the user Docker compose property or using the --user argument. This would break the privilege drop logic.