Add model_name and stepping to node_cpu_info metric

The `node_cpu_info` metric contains some information like the `model`
(which is an integer), but not the human readable model name. Also the
stepping of the processor might be interesting, since different stepping
of a processor might behave differently.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This commit is contained in:
Benjamin Drung 2020-02-20 17:36:02 +01:00 committed by Johannes 'fish' Ziemke
commit 34d50e15d5
4 changed files with 20 additions and 18 deletions

View file

@ -57,7 +57,7 @@ func NewCPUCollector(logger log.Logger) (Collector, error) {
cpuInfo: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "info"),
"CPU information from /proc/cpuinfo.",
[]string{"package", "core", "cpu", "vendor", "family", "model", "microcode", "cachesize"}, nil,
[]string{"package", "core", "cpu", "vendor", "family", "model", "model_name", "microcode", "stepping", "cachesize"}, nil,
),
cpuGuest: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "guest_seconds_total"),
@ -110,7 +110,9 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error {
cpu.VendorID,
cpu.CPUFamily,
cpu.Model,
cpu.ModelName,
cpu.Microcode,
cpu.Stepping,
cpu.CacheSize)
}
return nil