Containerized, multiarch version of node-exporter, used for Prometheus monitoring. Multi-stage build is used to build from official node-exporter source code. Designed to be usable within x86-64, arm64, armv6, and armv7 based Docker Swarm clusters. Added support for correct reporting of the underlying node hostname
This repository utilizes GitHub Actions to automatically build and deploy multiarch images to DockerHub when a new tag is pushed.
Setup local environment to support Docker experimental feature for building multi architecture images, buildx. Follow instructions here
Clone repo:
$ git clone https://github.com/jmb12686/node-exporter
$ cd node-exporter
Build multiarch image:
$ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6 -t jmb12686/node-exporter:latest --push .
Use in docker-compose swarm stack similar to base image for prom/node-exporter
, but added:
NODE_ID
as environment variable- mount
/etc/hostname
of underlying host to/etc/nodename
in the container. - Entrypoint script within container will use
/etc/nodename
andNODE_ID
to create custom data attributes and put config in/etc/node-exporter
. node-name
andnode-id
attributes are exposed in node-exporter
services:
.....
node-exporter:
image: jmb12686/node-exporter:latest
networks:
- net
environment:
- NODE_ID={{.Node.ID}}
ports:
- 9100:9100
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /etc/hostname:/etc/nodename:ro
command:
- '--path.sysfs=/host/sys'
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--collector.textfile.directory=/etc/node-exporter/'
- '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
- '--no-collector.ipvs'
deploy:
mode: global
resources:
limits:
memory: 32M