-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DNM osd: add 'ceph [tell|daemon] osd.id smart'
Also added 'ceph daemon osd.id list_devices' which prints to stdout the osd devices. 'ceph [tell|daemon] osd.id smart' probes the osd devices for SMART data and prints it to stdout in a JSON format. It assumes smartctl '--json' feature exists. Signed-off-by: Yaarit Hatuka <[email protected]>
- Loading branch information
Yaarit Hatuka
committed
Jan 16, 2018
1 parent
aab2def
commit d1d21e7
Showing
5 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
from module import * # NOQA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
""" | ||
Pulling smart data from OSD | ||
""" | ||
|
||
import json | ||
from mgr_module import MgrModule, CommandResult | ||
|
||
|
||
class Module(MgrModule): | ||
COMMANDS = [ | ||
{ | ||
"cmd": "osd smart get " | ||
"name=osd_id,type=CephString,req=true", | ||
"desc": "Get smart data for osd.id", | ||
"perm": "r" | ||
}, | ||
] | ||
|
||
def handle_command(self, cmd): | ||
self.log.error("handle_command") | ||
|
||
if cmd['prefix'] == 'osd smart get': | ||
result = CommandResult('') | ||
self.send_command(result, 'osd', 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']) |