]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: use set/remove health check function for CEPHADM_AGENT_DOWN
authorAdam King <adking@redhat.com>
Thu, 21 Oct 2021 12:04:11 +0000 (08:04 -0400)
committerAdam King <adking@redhat.com>
Thu, 21 Oct 2021 12:04:11 +0000 (08:04 -0400)
To be in line with how other health checks are set/removed

Signed-off-by: Adam King <adking@redhat.com>
src/pybind/mgr/cephadm/agent.py

index 35067c0f35a5b4d63d7be6dca0fadc37f433be50..668de663fa1f426074d76bcef57c02e23bfc0ce6 100644 (file)
@@ -321,22 +321,20 @@ class CephadmAgentHelpers:
         return False
 
     def _update_agent_down_healthcheck(self, down_agent_hosts: List[str]) -> None:
-        if 'CEPHADM_AGENT_DOWN' in self.mgr.health_checks:
-            del self.mgr.health_checks['CEPHADM_AGENT_DOWN']
+        self.mgr.remove_health_warning('CEPHADM_AGENT_DOWN')
         if down_agent_hosts:
             detail: List[str] = []
             for agent in down_agent_hosts:
                 detail.append((f'Cephadm agent on host {agent} has not reported in '
                               f'{2.5 * self.mgr.agent_refresh_rate} seconds. Agent is assumed '
                                'down and host may be offline.'))
-            self.mgr.health_checks['CEPHADM_AGENT_DOWN'] = {
-                'severity': 'warning',
-                'summary': '%d Cephadm Agent(s) are not reporting. '
-                'Hosts may be offline' % (len(down_agent_hosts)),
-                'count': len(down_agent_hosts),
-                'detail': detail,
-            }
-            self.mgr.set_health_checks(self.mgr.health_checks)
+            self.mgr.set_health_warning(
+                'CEPHADM_AGENT_DOWN',
+                summary='%d Cephadm Agent(s) are not reporting. Hosts may be offline' % (
+                    len(down_agent_hosts)),
+                count=len(down_agent_hosts),
+                detail=detail,
+            )
 
     # this function probably seems very unnecessary, but it makes it considerably easier
     # to get the unit tests working. All unit tests that check which daemons were deployed