From 5bb728358e32bb793ea27f618fcb49b8bc9787ce Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 8 Jun 2018 09:01:27 -0500 Subject: [PATCH 01/10] mgr/devicehealth: rename old smart module to devicehealth Let's avoid "SMART" since it's misleading (it refers specifically to ATA). Signed-off-by: Sage Weil --- src/pybind/mgr/devicehealth/__init__.py | 2 ++ src/pybind/mgr/devicehealth/module.py | 37 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/pybind/mgr/devicehealth/__init__.py create mode 100644 src/pybind/mgr/devicehealth/module.py diff --git a/src/pybind/mgr/devicehealth/__init__.py b/src/pybind/mgr/devicehealth/__init__.py new file mode 100644 index 0000000000000..4c5b97ce82b27 --- /dev/null +++ b/src/pybind/mgr/devicehealth/__init__.py @@ -0,0 +1,2 @@ + +from .module import Module diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py new file mode 100644 index 0000000000000..2e6755e617b73 --- /dev/null +++ b/src/pybind/mgr/devicehealth/module.py @@ -0,0 +1,37 @@ + +""" +Device health monitoring +""" + +import json +from mgr_module import MgrModule, CommandResult +import rados +from threading import Event +from datetime import datetime, timedelta, date, time + +class Module(MgrModule): + COMMANDS = [ + { + "cmd": "device query-daemon-health-metrics " + "name=osd_id,type=CephOsdName,req=true", + "desc": "Get device health metrics for a given daemon (OSD)", + "perm": "r" + }, + ] + + def handle_command(self, cmd): + self.log.error("handle_command") + + if cmd['prefix'] == 'device query-daemon-health-metrics': + result = CommandResult('') + self.send_command(result, 'osd', str(cmd['osd_id']), json.dumps({ + 'prefix': 'smart', + 'format': 'json', + }), '') + r, outb, outs = result.wait() + return (r, outb, outs) + + else: + # mgr should respect our self.COMMANDS and not call us for + # any prefix we don't advertise + raise NotImplementedError(cmd['prefix']) From 45b019feed1a8091cb5f1b44d43e611e61d14e20 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 8 Jun 2018 09:01:34 -0500 Subject: [PATCH 02/10] mgr: enable devicehealth by default Signed-off-by: Sage Weil --- src/common/options.cc | 2 +- src/vstart.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/options.cc b/src/common/options.cc index 83753de44102f..31b43b98e57e3 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -4749,7 +4749,7 @@ std::vector