aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo R. Galvão <rodrigo_rosatti@hotmail.com>2017-07-07 20:13:48 -0300
committerBryn M. Reeves <bmr@redhat.com>2018-03-27 15:03:56 +0100
commitf91d9e5a1b8b0a6e2b3088b1b735f71c03b6aeb7 (patch)
tree74134d265a3e1967e40c89f46048a6be77f2a53d
parente832d53c4192c385bf477e61da37ccb7397499b7 (diff)
downloadsos-f91d9e5a1b8b0a6e2b3088b1b735f71c03b6aeb7.tar.gz
[nvme] Create nvme plugin
This plugin collects configuration and system information about NVMe devices. The nvme-cli tool is used to get relevant information about firmware, supported commands, serial, model, usage, etc.. Fixes: #1053. Signed-off-by: Rodrigo R. Galvao <rosattig@br.ibm.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/nvme.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/sos/plugins/nvme.py b/sos/plugins/nvme.py
new file mode 100644
index 00000000..dd49083f
--- /dev/null
+++ b/sos/plugins/nvme.py
@@ -0,0 +1,43 @@
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+import os
+
+
+class Nvme(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """Collect config and system information about NVMe devices"""
+
+ plugin_name = "nvme"
+ packages = ('nvme-cli',)
+
+ def get_nvme_devices(self):
+ sys_block = os.listdir('/sys/block/')
+ return [dev for dev in sys_block if dev.startswith('nvme')]
+
+ def setup(self):
+ for dev in self.get_nvme_devices():
+ # runs nvme-cli commands
+ self.add_cmd_output([
+ "nvme list",
+ "nvme list-ns /dev/%s" % dev,
+ "nvme fw-log /dev/%s" % dev,
+ "nvme list-ctrl /dev/%s" % dev,
+ "nvme id-ctrl -H /dev/%s" % dev,
+ "nvme id-ns -H /dev/%s" % dev,
+ "nvme smart-log /dev/%s" % dev,
+ "nvme error-log /dev/%s" % dev,
+ "nvme show-regs /dev/%s" % dev])
+
+# vim: set et ts=4 sw=4 :