mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
Merge pull request #68 from matthiasr/remove-cgo-dependency
remove cgo dependency
This commit is contained in:
commit
5b20dad9ad
|
@ -11,11 +11,9 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// #include <unistd.h>
|
||||
import "C"
|
||||
|
||||
const (
|
||||
procStat = "/proc/stat"
|
||||
userHz = 100
|
||||
)
|
||||
|
||||
type statCollector struct {
|
||||
|
@ -112,7 +110,7 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|||
return err
|
||||
}
|
||||
// Convert from ticks to seconds
|
||||
value /= float64(C.sysconf(C._SC_CLK_TCK))
|
||||
value /= userHz
|
||||
c.cpu.With(prometheus.Labels{"cpu": parts[0], "mode": cpuFields[i]}).Set(value)
|
||||
}
|
||||
case parts[0] == "intr":
|
||||
|
|
Loading…
Reference in a new issue