]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/blkdev: collect non-SMART data too
authorSage Weil <sage@newdream.net>
Mon, 8 Feb 2021 18:53:24 +0000 (12:53 -0600)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Mar 2021 07:34:15 +0000 (15:34 +0800)
Call smartctl with -x instead of -a:

       -a, --all
              Prints  all SMART information about the disk, or TapeAlert infor‐
              mation about the tape drive or changer.  For ATA devices this  is
              equivalent to
              '-H -i -c -A -l error -l selftest -l selective'
              and for SCSI, this is equivalent to
              '-H -i -A -l error -l selftest'.
              For NVMe, this is equivalent to
              '-H -i -c -A -l error'.
              Note  that  for  ATA  disks  this  does  not enable the non-SMART
              options and the SMART options which require  support  for  48-bit
              ATA commands.

vs

       -x, --xall
              Prints all SMART and non-SMART information about the device.  For
              ATA devices this is equivalent to
              '-H -i -g all -g wcreorder -c -A  -f  brief  -l  xerror,error  -l
              xselftest,selftest -l selective -l directory -l scttemp -l scterc
              -l devstat -l defects -l sataphy'.
              and for SCSI, this is equivalent to
              '-H -i -g all -A -l error -l selftest -l background -l sasphy'.
              For NVMe, this is equivalent to
              '-H -i -c -A -l error'.

Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 176bb54da90e404646c0e80e0c3ea804bb8a58d6)

src/common/blkdev.cc
sudoers.d/ceph-osd-smartctl

index 8c76a90b6bb8d82fdd9c0ca1de309d47f1722b77..b32fbd4cfaf5413f9e4d7ff37f6dc49b9c5792d9 100644 (file)
@@ -700,8 +700,8 @@ static int block_device_run_smartctl(const string& devname, int timeout,
     timeout);
   smartctl.add_cmd_args(
     "smartctl",
-    "-a",
-    //"-x",
+    //"-a",    // all SMART info
+    "-x",    // all SMART and non-SMART info
     "--json=o",
     device.c_str(),
     NULL);
index 882e8b68121ba7763c41282484b97b34ce45f85d..f53f6af9bc0b44d75f5dcce7b1f63ea409ce7bd4 100644 (file)
@@ -1,4 +1,4 @@
 ## allow ceph-osd (which runs as user ceph) to collect device health metrics
 
-ceph ALL=NOPASSWD: /usr/sbin/smartctl -a --json=o /dev/*
+ceph ALL=NOPASSWD: /usr/sbin/smartctl -x --json=o /dev/*
 ceph ALL=NOPASSWD: /usr/sbin/nvme * smart-log-add --json /dev/*