mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-01-20 07:19:01 +01:00
Merge pull request #405 from dominikh/fix-freebsd-cpu
Fix build of cpu_freebsd.go
This commit is contained in:
commit
3b469e5547
@ -78,7 +78,7 @@ func getCPUTimes() ([]cputime, error) {
|
||||
}
|
||||
|
||||
type statCollector struct {
|
||||
cpu *prometheus.CounterVec
|
||||
cpu typedDesc
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -115,11 +115,11 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
return err
|
||||
}
|
||||
for cpu, t := range cpuTimes {
|
||||
ch <- c.cpu.mustNewConstMetric(float64(cpuTimes[base_idx+C.CP_USER]), strconv.Itoa(cpu), "user")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(cpuTimes[base_idx+C.CP_NICE]), strconv.Itoa(cpu), "nice")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(cpuTimes[base_idx+C.CP_SYS]), strconv.Itoa(cpu), "system")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(cpuTimes[base_idx+C.CP_INTR]), strconv.Itoa(cpu), "interrupt")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(cpuTimes[base_idx+C.CP_IDLE]), strconv.Itoa(cpu), "idle")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(t.user), strconv.Itoa(cpu), "user")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(t.nice), strconv.Itoa(cpu), "nice")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(t.sys), strconv.Itoa(cpu), "system")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(t.intr), strconv.Itoa(cpu), "interrupt")
|
||||
ch <- c.cpu.mustNewConstMetric(float64(t.idle), strconv.Itoa(cpu), "idle")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user