From: Sage Weil Date: Sat, 18 Aug 2018 12:41:44 +0000 (-0500) Subject: mgr/devicehealth: add 'device monitoring {on,off}' commands X-Git-Tag: v14.0.1~451^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6d9134880b2da3159ebcf6926a0abdf076add1a8;p=ceph.git mgr/devicehealth: add 'device monitoring {on,off}' commands Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 937cab3d66d2f..ac7fa7a0ed2f7 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -78,6 +78,16 @@ class Module(MgrModule): "desc": "Check life expectancy of devices", "perm": "rw", }, + { + "cmd": "device monitoring on", + "desc": "Enable device health monitoring", + "perm": "rw", + }, + { + "cmd": "device monitoring off", + "desc": "Disable device health monitoring", + "perm": "rw", + }, ] def __init__(self, *args, **kwargs): @@ -120,6 +130,14 @@ class Module(MgrModule): return self.show_device_metrics(cmd['devid'], cmd.get('sample')) elif cmd['prefix'] == 'device check-health': return self.check_health() + elif cmd['prefix'] == 'device monitoring on': + self.set_config('enable_monitoring', 'true') + self.event.set() + return 0, '', '' + elif cmd['prefix'] == 'device monitoring off': + self.set_config('enable_monitoring', 'false') + self.set_health_checks({}) # avoid stuck health alerts + return 0, '', '' else: # mgr should respect our self.COMMANDS and not call us for # any prefix we don't advertise