Browse Source

Add CPU MHz as the value for "node_cpu_info" metric

For CPUs which don't have an available (or insertable) cpufreq driver,
the /proc/cpuinfo file can sometimes have accurate CPU core frequency
measurements. This change replaces the constant value of "1" for the
"node_cpu_info" metric with the parsed CPU MHz value from
/proc/cpuinfo for each core.

Signed-off-by: John Kordich <jkordich@gmail.com>
pull/2786/head
John Kordich 1 year ago committed by Johannes 'fish' Ziemke
parent
commit
223ebbd50c
  1. 2
      collector/cpu_linux.go

2
collector/cpu_linux.go

@ -184,7 +184,7 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error {
for _, cpu := range info { for _, cpu := range info {
ch <- prometheus.MustNewConstMetric(c.cpuInfo, ch <- prometheus.MustNewConstMetric(c.cpuInfo,
prometheus.GaugeValue, prometheus.GaugeValue,
1, cpu.CPUMHz,
cpu.PhysicalID, cpu.PhysicalID,
cpu.CoreID, cpu.CoreID,
strconv.Itoa(int(cpu.Processor)), strconv.Itoa(int(cpu.Processor)),

Loading…
Cancel
Save