{"record":{"id":"a8c66de6b401b29d","repo":"prometheus/node_exporter","slug":"failed-to-get-clock-ticks-per-second-v","errorCode":null,"errorMessage":"failed to get clock ticks per second: %v","messagePattern":"failed to get clock ticks per second: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/cpu_aix.go","lineNumber":73,"sourceCode":"\tcpu              typedDesc\n\tcpuPhysical      typedDesc\n\tcpuRunQueue      typedDesc\n\tcpuFlags         typedDesc\n\tcpuContextSwitch typedDesc\n\n\tlogger             *slog.Logger\n\ttickPerSecond      float64\n\tpurrTicksPerSecond float64\n}\n\nfunc init() {\n\tregisterCollector(\"cpu\", defaultEnabled, NewCpuCollector)\n}\n\nfunc tickPerSecond() (float64, error) {\n\tticks, err := C.sysconf(C._SC_CLK_TCK)\n\tif ticks == -1 || err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to get clock ticks per second: %v\", err)\n\t}\n\treturn float64(ticks), nil\n}\n\nfunc NewCpuCollector(logger *slog.Logger) (Collector, error) {\n\tticks, err := tickPerSecond()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpconfig, err := perfstat.PartitionStat()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &cpuCollector{\n\t\tcpu:                typedDesc{nodeCPUSecondsDesc, prometheus.CounterValue},","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/cpu_aix.go#L55-L91","documentation":"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.","triggerScenarios":"C.sysconf(C._SC_CLK_TCK) returns -1 or sets errno during NewCpuCollector on AIX.","commonSituations":"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).","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"],"exampleFix":"// before\nticks, err := C.sysconf(C._SC_CLK_TCK) // -1\n// after\ncheck `getconf CLK_TCK` on the host; fix OS config or upgrade AIX before running the exporter","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"ticks, err := tickPerSecond()\nif err != nil {\n    // verify OS-level configuration before retrying\n    out, _ := exec.LookPath(\"getconf\")\n    _ = out\n    log.Error(\"CLK_TCK unavailable; cpu metrics disabled\", \"err\", err)\n    return nil\n}","preventionTips":["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"],"tags":["aix","cpu","cgo"],"backgroundTag":"sysconf-clock-ticks-failed","analyzedSha":"17ddd77c59ba27e1508e9f7894b1e55b44d6aed3","analyzedAt":"2026-09-07T17:54:06.211Z","contentChangedAt":"2026-09-07T17:54:06.211Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}