Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.
/ docker-node-exporter Public archive

Node exporter that can expose the host hostname if an specific file is mounted in the container

Notifications You must be signed in to change notification settings

bvis/docker-node-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

basi/node-exporter

It is a simple node-exporter image that adds the capability of obtain the host hostname and expose it as a value in the container.

How to run it

To launch it as a global service in a swarm cluster:

docker \
  service create --mode global \
  --name node-exporter \
  --mount type=bind,source=/proc,target=/host/proc \
  --mount type=bind,source=/sys,target=/host/sys \
  --mount type=bind,source=/,target=/rootfs \
  --mount type=bind,source=/etc/hostname,target=/etc/host_hostname \
  -e HOST_HOSTNAME=/etc/host_hostname \
  basi/node-exporter:latest \
  --path.procfs /host/proc \
  --path.sysfs /host/sys \
  --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)" \
  --collector.textfile.directory /etc/node-exporter/

The important add over the official image is the bind mount of the host /etc/hosts file in a specific location in the service. This mount is used by the container to obtain the hostname of the host where the service is running.

It can be useful to use this value in a swarm cluster when obtaining data in Prometheus, while it does not support swarm mode natively.

About

Node exporter that can expose the host hostname if an specific file is mounted in the container

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages