From 2a0351c65c6277cb2842686e7256a43c219c7d75 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Sun, 31 Jan 2021 15:06:36 +0800 Subject: [PATCH] Check fan speed before check fan status (#6586) **- Why I did it** In thermalctd, when speed of fan exceeds threshold, the fan status will be saved as "bad". So in system health, it is better to check fan speed before fan status. In this case, if fan speed exceeds threshold, we get more detailed information. **- How I did it** Move fan speed check logic before fan status check **- How to verify it** Manual test --- src/system-health/health_checker/hardware_checker.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/system-health/health_checker/hardware_checker.py b/src/system-health/health_checker/hardware_checker.py index cf5b86bea2..7bbc4bdaca 100644 --- a/src/system-health/health_checker/hardware_checker.py +++ b/src/system-health/health_checker/hardware_checker.py @@ -89,11 +89,6 @@ class HardwareChecker(HealthChecker): self.set_object_not_ok('Fan', name, '{} is missing'.format(name)) continue - status = data_dict.get('status', 'false') - if status.lower() != 'true': - self.set_object_not_ok('Fan', name, '{} is broken'.format(name)) - continue - if not self._ignore_check(config.ignore_devices, 'fan', name, 'speed'): speed = data_dict.get('speed', None) speed_target = data_dict.get('speed_target', None) @@ -130,6 +125,11 @@ class HardwareChecker(HealthChecker): speed_tolerance)) continue + status = data_dict.get('status', 'false') + if status.lower() != 'true': + self.set_object_not_ok('Fan', name, '{} is broken'.format(name)) + continue + self.set_object_ok('Fan', name) def _check_psu_status(self, config):