How machine type is determined
Machines can be classified into one of the two major types depending on their underlying fundamental architecture: physical machines, and virtual machines.
Prometheus Juju Exporter offers an experimental feature which allows users to specify the criteria for determining the type of a machine based on its MAC addresses. This capability is implemented through two configuration options: match-interfaces
and virtual-macs
.
The match-interfaces
configuration allows the user to specify which network interfaces to use when searching for the MAC address of the machine. This capability is crucial as it is common for machines to have multiple network interfaces, of which only a subset may be “real” or relevant for identification purposes. By default, Predictable Network Interface Names and legacy eth* interface names are considered.
The virtual-macs
configuration option enables users to specify a list of MAC address prefixes that should be treated as virtual machines. By default, this option includes the most commonly encountered MAC prefixes in virtual environments, such as those used by QEMU, Microsoft, and VMware.
When evaluating the list of network interfaces on a machine that matches the match-interfaces
regex, if any interface’s MAC address matches a prefix listed in virtual-macs
, the machine is classified as a virtual machine. If no such prefixes are found, the machine is considered to be a physical machine.
Example usage:
# consider only interfaces matching regex `eth[0-9]+`, such as “eth0”, “eth29”, and ignore the other ones found on the machine
juju config prometheus-juju-exporter match-interfaces=”eth[0-9]+”
# MAC addresses that start with the prefixes 00:50:56 or fa:16:3e should be identified as virtual, such as 00:50:56:1f:28 or fa:16:3e:84:06
juju config prometheus-juju-exporter virtual-macs=”00:50:56,fa:16:3e”