Raja's Exocortex

Prometheus Node Exporter

Running Prometheus Node Exporter in a docker container and exporting OS metrics to Prometheus and Grafana.

# docker-compose file to start up node-exporter on tcp:9100
# to start the container run:
#    docker-compose up -d

name: node_exporter-localhost

services:
  node_exporter:
    image: prom/node-exporter:latest
    container_name: node_exporter.localhost
    restart: always

    mem_limit: 128M

    ports:
      - 9100:9100

    pid: host

    command:
      - '--path.rootfs=/host'

    volumes:
      - '/:/host:ro,rslave'

    labels:
      - com.centurylinklabs.watchtower.enable=true

Sample prometheus.yml

# Filename: prometheus.yml for scraping node_exporter metrics
# Change 10.10.10.10-11 with the node_exporter host IPs.

scrape_configs:

  - job_name: "node_exporter"

    static_configs:
      - targets: ["10.10.10.10:9100"]
        labels:
          app: "host-1"
          nodename: "host-1"

      - targets: ["10.10.10.11:9100"]
        labels:
          app: "host-2"
          nodename: "host-2"