mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 20:36:21 +01:00
Fix cpufreq statistics by converting kHz to Hz
This commit is contained in:
parent
182810056f
commit
bcc3cd92b8
@ -104,20 +104,21 @@ func (c *cpuCollector) updateCPUfreq(ch chan<- prometheus.Metric) error {
|
|||||||
if _, err := os.Stat(filepath.Join(cpu, "cpufreq")); os.IsNotExist(err) {
|
if _, err := os.Stat(filepath.Join(cpu, "cpufreq")); os.IsNotExist(err) {
|
||||||
log.Debugf("CPU %q is missing cpufreq", cpu)
|
log.Debugf("CPU %q is missing cpufreq", cpu)
|
||||||
} else {
|
} else {
|
||||||
|
// cpufreq values are kHz, multiply by 1000 for hz
|
||||||
if value, err = readUintFromFile(filepath.Join(cpu, "cpufreq/scaling_cur_freq")); err != nil {
|
if value, err = readUintFromFile(filepath.Join(cpu, "cpufreq/scaling_cur_freq")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ch <- prometheus.MustNewConstMetric(c.cpuFreq, prometheus.GaugeValue, float64(value), cpuname)
|
ch <- prometheus.MustNewConstMetric(c.cpuFreq, prometheus.GaugeValue, float64(value)*1000.0, cpuname)
|
||||||
|
|
||||||
if value, err = readUintFromFile(filepath.Join(cpu, "cpufreq/scaling_min_freq")); err != nil {
|
if value, err = readUintFromFile(filepath.Join(cpu, "cpufreq/scaling_min_freq")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ch <- prometheus.MustNewConstMetric(c.cpuFreqMin, prometheus.GaugeValue, float64(value), cpuname)
|
ch <- prometheus.MustNewConstMetric(c.cpuFreqMin, prometheus.GaugeValue, float64(value)*1000.0, cpuname)
|
||||||
|
|
||||||
if value, err = readUintFromFile(filepath.Join(cpu, "cpufreq/scaling_max_freq")); err != nil {
|
if value, err = readUintFromFile(filepath.Join(cpu, "cpufreq/scaling_max_freq")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ch <- prometheus.MustNewConstMetric(c.cpuFreqMax, prometheus.GaugeValue, float64(value), cpuname)
|
ch <- prometheus.MustNewConstMetric(c.cpuFreqMax, prometheus.GaugeValue, float64(value)*1000.0, cpuname)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(filepath.Join(cpu, "thermal_throttle")); os.IsNotExist(err) {
|
if _, err := os.Stat(filepath.Join(cpu, "thermal_throttle")); os.IsNotExist(err) {
|
||||||
|
@ -215,19 +215,19 @@ node_cpu_core_throttles_total{cpu="cpu1"} 0
|
|||||||
node_cpu_core_throttles_total{cpu="cpu2"} 40
|
node_cpu_core_throttles_total{cpu="cpu2"} 40
|
||||||
# HELP node_cpu_frequency_hertz Current cpu thread frequency in hertz.
|
# HELP node_cpu_frequency_hertz Current cpu thread frequency in hertz.
|
||||||
# TYPE node_cpu_frequency_hertz gauge
|
# TYPE node_cpu_frequency_hertz gauge
|
||||||
node_cpu_frequency_hertz{cpu="cpu0"} 1.699981e+06
|
node_cpu_frequency_hertz{cpu="cpu0"} 1.699981e+09
|
||||||
node_cpu_frequency_hertz{cpu="cpu1"} 1.699981e+06
|
node_cpu_frequency_hertz{cpu="cpu1"} 1.699981e+09
|
||||||
node_cpu_frequency_hertz{cpu="cpu3"} 8000
|
node_cpu_frequency_hertz{cpu="cpu3"} 8e+06
|
||||||
# HELP node_cpu_frequency_max_hertz Maximum cpu thread frequency in hertz.
|
# HELP node_cpu_frequency_max_hertz Maximum cpu thread frequency in hertz.
|
||||||
# TYPE node_cpu_frequency_max_hertz gauge
|
# TYPE node_cpu_frequency_max_hertz gauge
|
||||||
node_cpu_frequency_max_hertz{cpu="cpu0"} 3.7e+06
|
node_cpu_frequency_max_hertz{cpu="cpu0"} 3.7e+09
|
||||||
node_cpu_frequency_max_hertz{cpu="cpu1"} 3.7e+06
|
node_cpu_frequency_max_hertz{cpu="cpu1"} 3.7e+09
|
||||||
node_cpu_frequency_max_hertz{cpu="cpu3"} 4.2e+06
|
node_cpu_frequency_max_hertz{cpu="cpu3"} 4.2e+09
|
||||||
# HELP node_cpu_frequency_min_hertz Minimum cpu thread frequency in hertz.
|
# HELP node_cpu_frequency_min_hertz Minimum cpu thread frequency in hertz.
|
||||||
# TYPE node_cpu_frequency_min_hertz gauge
|
# TYPE node_cpu_frequency_min_hertz gauge
|
||||||
node_cpu_frequency_min_hertz{cpu="cpu0"} 800000
|
node_cpu_frequency_min_hertz{cpu="cpu0"} 8e+08
|
||||||
node_cpu_frequency_min_hertz{cpu="cpu1"} 800000
|
node_cpu_frequency_min_hertz{cpu="cpu1"} 8e+08
|
||||||
node_cpu_frequency_min_hertz{cpu="cpu3"} 1000
|
node_cpu_frequency_min_hertz{cpu="cpu3"} 1e+06
|
||||||
# HELP node_cpu_package_throttles_total Number of times this cpu package has been throttled.
|
# HELP node_cpu_package_throttles_total Number of times this cpu package has been throttled.
|
||||||
# TYPE node_cpu_package_throttles_total counter
|
# TYPE node_cpu_package_throttles_total counter
|
||||||
node_cpu_package_throttles_total{cpu="cpu0"} 30
|
node_cpu_package_throttles_total{cpu="cpu0"} 30
|
||||||
|
Loading…
Reference in New Issue
Block a user