From: Sage Weil Date: Mon, 25 Jun 2018 13:54:57 +0000 (-0500) Subject: mgr/devicehealth: add 'device check-health' command and run periodically X-Git-Tag: v14.0.1~723^2~10 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8deec7445ff4286ccca88abaad4c2e5b5536a42d;p=ceph.git mgr/devicehealth: add 'device check-health' command and run periodically Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index b120a3bd02beb..652777a2c9b5e 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -57,6 +57,11 @@ class Module(MgrModule): "desc": "Show stored device metrics for the device", "perm": "r" }, + { + "cmd": "device check-health", + "desc": "Check life expectancy of devices", + "perm": "rw", + }, ] def __init__(self, *args, **kwargs): @@ -97,6 +102,8 @@ class Module(MgrModule): return self.scrape_all(); elif cmd['prefix'] == 'device show-health-metrics': return self.show_device_metrics(cmd['devid'], cmd.get('sample')) + elif cmd['prefix'] == 'device check-health': + return self.check_health() else: # mgr should respect our self.COMMANDS and not call us for # any prefix we don't advertise @@ -145,8 +152,7 @@ class Module(MgrModule): if not self.enable_monitoring: continue self.log.debug('Running') - - # WRITE ME + self.check_health() def shutdown(self): self.log.info('Stopping') @@ -308,7 +314,8 @@ class Module(MgrModule): pass return (0, json.dumps(res, indent=4), '') - def life_expectancy_response(self): + def check_health(self): + self.log.info('Check health') mark_out_threshold_td = timedelta(seconds=int(self.mark_out_threshold)) warn_threshold_td = timedelta(seconds=int(self.warn_threshold)) health_warnings = []