I have setup my monitoring with the cadvisor, node-exporter, prometheus, grafana stack in my clustered environment using docker swarm.

What is the easiest way to get my actual hostnames picked up by node-exporter, so I can configure my dashboards to filter by node names in grafana?

For my kubernetes environments this works ootb, because all metrics are extended by the kubernetes_io_hostname, that contains the actual hostname.

The only solution to this I found, so far, was to introduce my own metric, that creates the combination between node ids and node names (like done by https://github.com/bvis/docker-node-exporter). But I really like to use the vanilla image (for update reasons, for example) and also mounting some file with the configuration on all machines seems to be too much effort to do this.

So does anyone know: Is there an easy way to get the hostname of the node into my node-exporter metrics? Maybe by just mounting the hosts /etc/hostname file to a specific place in the node-exporter container, or something like that?

Thanks in advance!

Best regards, razr

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.