Why are exporters such as the Node Exporter usually installed directly on the target hosts rather than in Docker containers, and what should be configured when rolling them out?
They are self-contained Go programs, so a native install is easy and a container would only add overhead. Roll them out with automation such as Ansible, and enable only the collectors for technology the host actually has.
* What the exporter does not collect never reaches Prometheus: the choice is made in the collector list. *
On the Prometheus servers, Docker is convenient: the developers publish an image that is updated with every release. On the targets the trade-off flips. Most exporters, the Node Exporter included, are written in Go and ship as a single binary without dependencies, so they can be installed directly at any time, even long after the hosts went into service. A container around them adds no real value and enlarges the performance footprint on every monitored machine.
Two things then matter during rollout:
- Automation is practically mandatory. Hundreds of hosts cannot be set up by hand, so an Ansible playbook (or a Chef cookbook, Puppet or Salt module) installs the exporter everywhere. Once that is part of the automation, adding further exporters later is a small change.
- Choose the collectors. The Node Exporter is modular: each collector reads one subsystem (CPU, memory, file systems, network, …). Enable only what exists on the host. A collector for DRBD (Distributed Replicated Block Device, a disk mirrored over the network) is pointless on a machine without DRBD.
The selection has to happen on the exporter side, because a scrape always fetches all metrics an exporter offers. What the exporter does not collect never reaches Prometheus.
Go deeper:
prometheus-community/ansible on GitHub — the Ansible collection that rolls out the Node Exporter and other exporters.
DRBD — Wikipedia — what the network-mirrored block device is, and so when its collector makes sense.