From 07cbb107198145c425b052482f6c38abacf806f0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 8 Jun 2018 09:01:27 -0500 Subject: [PATCH] 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..c1434d4dd3f5c --- /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, inbuf, 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']) -- 2.39.5