A customer node-exporter (https://hub.docker.com/r/prom/node-exporter) Docker Image that adds an addition time-series metric called node_meta.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
James Mills 0f7efcc9a2
Fix node_name detection
2 weeks ago
.drone.yml Fix node_name detection 2 weeks ago
.gitignore Initial Commit 2 months ago
Dockerfile Fix node_name detection 2 weeks ago
LICENSE Initial Commit 2 months ago
README.md Add screenshot of example Grafana dashbaord 2 months ago
entrypoint.sh Fix bug passing NODE_NAME env var 2 months ago
screenshot.png Add screenshot of example Grafana dashbaord 2 months ago

README.md

node-exporter

Build Status

A customer node-exporter Docker Image that adds an addition time-series metric called node_meta that contains the following balels:

  • container_label_com_docker_swarm_node_id
  • node_name
  • node_id

Build

TO build the image:

docker build -t node-exporter .

Tip: Recommend publishing this to your own private Docker registry.

Usage

To use this image simply run it as per normal with an environment variable NODE_ID and volume /etc/nodename. e.g:

$ docker run -i -t --rm -e NODE_ID=6 -v /etc/hostname:/etc/nodename node-exporter

Or in a Docker stack/compose:

---
version: "3.8"

services:

  node_exporter:
    image: node-exporter
    environment:
      - NODE_ID={{.Node.ID}}
    command:
      - --path.sysfs=/host/sys
      - --path.procfs=/host/proc
      - --collector.textfile.directory=/etc/node-exporter/
      - --collector.filesystem.ignored-fs-types="^(sys|proc|auto)fs|overlay$$"
      - --collector.filesystem.ignored-mount-points="^/(sys|proc|dev|host|etc)($$|/)"
      - --no-collector.ipvs
    networks:
      - prometheus
    volumes:
      - /etc/hostname:/etc/nodename
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    deploy:
      mode: global
      restart_policy:
        condition: on-failure

networks:
  prometheus:
    driver: overlay

See this yarn for an example and demo of using this in real infrastructure.

Example PromQL

sum(
  (
    node_memory_MemAvailable_bytes{job="docker_nodes"}
    /
    node_memory_MemTotal_bytes{job="docker_nodes"} * 100
  )
  * on(instance) group_left(node_id, node_name) node_meta
) by (node_id, node_name)

Example Grafana Dashboard

License

This image is licensed under the terms of the MIT with material borrowed from Swarmprom - Prometheus Monitoring for Docker Swarm