fix: tolerate unavailable CPU sensor telemetry
This commit is contained in:
@@ -139,13 +139,34 @@ echo "no new thermal throttling detected during this run"
|
||||
`
|
||||
}
|
||||
|
||||
// cpuSensorsProbeScript preserves lm-sensors output in the SAT evidence while
|
||||
// distinguishing an unsupported local hwmon interface from a broken command.
|
||||
//
|
||||
// Some otherwise healthy servers expose thermal telemetry only through BMC/IPMI
|
||||
// (or need a platform-specific hwmon module that the current kernel does not
|
||||
// provide). lm-sensors returns 1 and prints "No sensors found!" in that case.
|
||||
// That must not turn a successful CPU stress test into a false failure. Other
|
||||
// non-zero exits remain failures: they can indicate a missing/broken sensors
|
||||
// binary or a real runtime problem.
|
||||
func cpuSensorsProbeScript() string {
|
||||
return `output=$(sensors 2>&1)
|
||||
rc=$?
|
||||
printf '%s\n' "$output"
|
||||
if [ "$rc" -ne 0 ] && printf '%s\n' "$output" | grep -Fq 'No sensors found!'; then
|
||||
echo 'CPU temperature telemetry is unavailable through lm-sensors; continuing without local hwmon readings.'
|
||||
exit 0
|
||||
fi
|
||||
exit "$rc"
|
||||
`
|
||||
}
|
||||
|
||||
func cpuSATJobs(durationSec int) []satJob {
|
||||
return []satJob{
|
||||
{name: "01-lscpu.log", cmd: []string{"lscpu"}},
|
||||
{name: "02-sensors-before.log", cmd: []string{"sensors"}},
|
||||
{name: "02-sensors-before.log", cmd: []string{"sh", "-c", cpuSensorsProbeScript()}},
|
||||
{name: "02-thermal-throttle-before.log", cmd: []string{"sh", "-c", cpuThrottleBeforeScript()}, informational: true},
|
||||
{name: "03-stress-ng.log", cmd: []string{"stress-ng", "--cpu", "0", "--cpu-method", "all", "--timeout", fmt.Sprintf("%d", durationSec)}, syncBracket: true},
|
||||
{name: "04-sensors-after.log", cmd: []string{"sensors"}},
|
||||
{name: "04-sensors-after.log", cmd: []string{"sh", "-c", cpuSensorsProbeScript()}},
|
||||
{name: "05-thermal-throttle-check.log", cmd: []string{"sh", "-c", cpuThrottleCheckScript()}},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user