prometheus/node_exporter · error
failed to get clock ticks per second
Error message
failed to get clock ticks per second: %v
What it means
On AIX, tickPerSecond calls the libc sysconf(_SC_CLK_TCK) via cgo to determine clock ticks per second, needed to convert CPU time samples into seconds. A return value of -1 or a non-nil error means the system call failed, so the CPU collector cannot be created correctly and this error is propagated.
Solutions
- Verify the AIX system's CLK_TCK configuration is sane (getconf CLK_TCK should return a positive number)
- Rebuild with a working cgo toolchain for AIX
- If unresolved, disable the cpu collector on that host
Example fix
// before ticks, err := C.sysconf(C._SC_CLK_TCK) // -1 // after check `getconf CLK_TCK` on the host; fix OS config or upgrade AIX before running the exporter
Defensive patterns
Strategy: try-catch
Try / catch
ticks, err := tickPerSecond()
if err != nil {
// verify OS-level configuration before retrying
out, _ := exec.LookPath("getconf")
_ = out
log.Error("CLK_TCK unavailable; cpu metrics disabled", "err", err)
return nil
} Prevention
- Verify `getconf CLK_TCK` returns a sane value on target AIX hosts before deploying
- Keep the AIX cgo toolchain and OS patches current
- Treat repeated sysconf failures as an OS-level problem, not an exporter bug
When it happens
Trigger: C.sysconf(C._SC_CLK_TCK) returns -1 or sets errno during NewCpuCollector on AIX.
Common situations: Corrupted/unusual system configuration on AIX; cgo environment issues at runtime; running an AIX-targeted build on an environment where sysconf misbehaves (rare, mostly a platform-level fault).
Related errors
AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07).
Data as JSON: /api/errors/a8c66de6b401b29d.
Report an issue: GitHub.
Appendix: source
Thrown at collector/cpu_aix.go:73
cpu typedDesc
cpuPhysical typedDesc
cpuRunQueue typedDesc
cpuFlags typedDesc
cpuContextSwitch typedDesc
logger *slog.Logger
tickPerSecond float64
purrTicksPerSecond float64
}
func init() {
registerCollector("cpu", defaultEnabled, NewCpuCollector)
}
func tickPerSecond() (float64, error) {
ticks, err := C.sysconf(C._SC_CLK_TCK)
if ticks == -1 || err != nil {
return 0, fmt.Errorf("failed to get clock ticks per second: %v", err)
}
return float64(ticks), nil
}
func NewCpuCollector(logger *slog.Logger) (Collector, error) {
ticks, err := tickPerSecond()
if err != nil {
return nil, err
}
pconfig, err := perfstat.PartitionStat()
if err != nil {
return nil, err
}
return &cpuCollector{
cpu: typedDesc{nodeCPUSecondsDesc, prometheus.CounterValue},View on GitHub (pinned to 17ddd77c59)