Commit Graph

113 Commits

Author SHA1 Message Date
chrfranke ae0edc7d55 smartd.cpp: Don't write Copyright line to syslog.
This prevents that logfile analyzers need an extra suppression rule
(Red Hat Bugzilla 673758 and 1162741).
utility.cpp, utility.h: Enhance 'format_version_info()' accordingly.
smartctl.cpp: Adjust function call.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5519 4ea69e1a-61f1-4043-bf83-b5c94c648137
2023-07-24 15:57:54 +00:00
chrfranke 4a91d450e1 smartctl.cpp: Don't include '-l farm' in '-x'. Suggest it if supported.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5484 4ea69e1a-61f1-4043-bf83-b5c94c648137
2023-06-25 17:29:41 +00:00
chrfranke ad319b8b62 ataprint.cpp: Suggest '-x' option if only '-a' is used.
ataprint.h, smartctl.cpp: Add 'ata_print_options.a_option' flag.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5483 4ea69e1a-61f1-4043-bf83-b5c94c648137
2023-06-25 17:09:03 +00:00
chrfranke 13a3dbf60e Large update adding pulling and parsing of Seagate's vendor-specific
Field Access Reliability Metrics (FARM) log to supported ATA and SCSI
drives (GH pull/180).
Running smartctl with '-l farm' will print the top predictive metrics
from FARM for drive health monitoring. Can be printed with plain-text
or JSON ('-j'). FARM can also be printed with '-a' and '-x', but no
error messages will be printed, unlike '-l farm'.

farmcmds.h: Add structures to store FARM data.
farmcmds.cpp: Add functions to pull FARM data from drive.
farmprint.h: Add function declarations for printing FARM data.
farmprint.cpp: Add function definitions for printing FARM data.
ataprint.h: Add checking FARM command-line option.
ataprint.cpp: Add checking if drive is Seagate and supports FARM.
scsiprint.h: Add checking FARM command-line option.
scsiprint.cpp: Add checking if drive is Seagate and supports FARM.
smartctl.cpp: Add command-line option parsing for FARM.
smartctl.8.in: Add '-l farm' description to manual.
Makefile.am: Add new FARM files.
AUTHORS: Add myself and Natan Lidukhover to list of contributors.

Patch by Michael Cordle.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5462 4ea69e1a-61f1-4043-bf83-b5c94c648137
2023-03-13 10:45:06 +00:00
dpgilbert 2fc5ece4af add smartctl support for SCSI General statistics and performance log page
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5452 4ea69e1a-61f1-4043-bf83-b5c94c648137
2023-02-10 06:18:05 +00:00
chrfranke 4c974b3178 Add NVMe self-test support to smartctl (#894).
Supported options: '-l selftest', '-t short', '-t long' and '-X'.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5408 4ea69e1a-61f1-4043-bf83-b5c94c648137
2022-09-18 14:50:33 +00:00
chrfranke 4517f1cf72 smartctl.cpp: Add 'smartctl.pre_release' boolean to JSON output.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5354 4ea69e1a-61f1-4043-bf83-b5c94c648137
2022-04-22 19:14:42 +00:00
dpgilbert 54408c7912 smartctl.cpp, scsiprint.cpp: extend --log=defects option so it works for the SCSI Pending Defects log page; add --log=envrep option to output Environmental Reporting log page; add: --log=zdevstat option to output Zone block device statistics log page; fix spelling
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5333 4ea69e1a-61f1-4043-bf83-b5c94c648137
2022-02-26 00:15:22 +00:00
dpgilbert 7b61731ee9 smartctl.cpp, scsiprint.cpp: implement the change to TapeAlert handling documented in the previous commit
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5322 4ea69e1a-61f1-4043-bf83-b5c94c648137
2022-02-21 03:32:46 +00:00
dpgilbert 98b87ae6d2 smartctl.cpp: add new --log=tapedevstat to print out SCSI Tape (SSC) Device Statistics log page
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5317 4ea69e1a-61f1-4043-bf83-b5c94c648137
2022-02-17 03:25:14 +00:00
dpgilbert 0a99f99d26 add support for SCSI Environmental Reporting log (sub)page
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5274 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-12-21 20:53:44 +00:00
chrfranke 67fe6ca4fc smartctl.cpp: Fix possible buffer overflow (#1546).
An overflow of 1-2 bytes occurred only if the '-n' option
was specified with an invalid argument.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5260 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-11-29 18:33:26 +00:00
chrfranke 339639dfaf smartctl.cpp: Fix 'optopt' range check (cppcheck 2.3: invalidFunctionArg).
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5204 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-02-07 17:04:42 +00:00
chrfranke 5279a70c52 Always add timestamp to JSON output (#1436).
Move non-JSON timestamp output to common function.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5200 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-02-07 14:19:40 +00:00
chrfranke 2535f754ee ataprint.cpp, ataprint.h, smartctl.cpp: Optionally exit immediately
if '-n POWERMODE' option is not supported (#1381).
smartctl.8.in: Document new STATUS2 Parameter for '-n POWERMODE'.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5192 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-02-01 17:26:52 +00:00
chrfranke 3e7bb6f257 ataprint.cpp, ataprint.h, smartctl.cpp: Rework sct_erc variables.
Fix handling of '-l scterc*,p' if both get and set are used.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5173 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-01-20 19:27:19 +00:00
chrfranke ab58013aae smartctl.cpp: Change '-l scterc,r' to '-l scterc,reset'.
Make ',p' case sensitive.  Simplify parsing of 'scterc...'.
smartctl.8.in: Change documentation accordingly.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5172 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-01-20 17:46:42 +00:00
chrfranke 8de092293d Add support for SCT Error Recovery Timer features added in ACS-4 (#1427).
'-l scterc[,R,W],p' option gets/sets the persistent power-on values.
'-l scterc,r' option restores to the manufacturer's default values.

Patch by Jeremy Bauer.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5166 4ea69e1a-61f1-4043-bf83-b5c94c648137
2021-01-15 18:02:19 +00:00
dpgilbert 95fc2aa01f smartctl: expand -s option with standby,now and standby,off (or standby,0) to include SCSI
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5131 4ea69e1a-61f1-4043-bf83-b5c94c648137
2020-12-15 21:30:33 +00:00
dpgilbert 66267a4ffc initial SCSI commits to support 'smartctl -n'
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5127 4ea69e1a-61f1-4043-bf83-b5c94c648137
2020-12-06 00:58:36 +00:00
chrfranke 75b9cb6140 json.cpp, json.h: Add YAML support.
smartctl.cpp: Add '--json=y' option.
smartctl.8.in: Document new option.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5113 4ea69e1a-61f1-4043-bf83-b5c94c648137
2020-11-07 15:38:57 +00:00
chrfranke 15e1335f08 smartctl.cpp: Set JSON format version to 1.0 (#766).
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4871 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-12-27 20:03:12 +00:00
chrfranke c17df18b55 ataprint.cpp, ataprint.h: Remove request to send '-l defects' output.
Remove 'pending_defects_info' flag.
smartctl.cpp, smartctl.8.in: Add '-l defects' to '-x' output.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4826 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-11-02 20:09:12 +00:00
chrfranke 457592c356 json.cpp, json.h: Add 'pretty' print option.
smartctl.cpp, smartctl.8.in: Add '--json=c' option to disable pretty-printing.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4825 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-10-25 19:47:35 +00:00
chrfranke 5fefe98d0d ataprint.cpp, nvmeprint.cpp, smartctl.cpp: Use const references for json::ref
function parameters.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4824 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-10-25 19:20:30 +00:00
chrfranke 4275958ca8 json.cpp, json.h: Change handling of unsafe and 128-bit integers:
Output as string 'KEY_s' and LE byte array 'KEY_le' if range exceeded
or verbose mode enabled.
smartctl.cpp, smartctl.8.in: Add '--json=v' option.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4820 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-10-23 21:25:37 +00:00
chrfranke 6207c7e402 smartctl.cpp, smartd.cpp, os_linux.cpp, os_solaris.cpp:
Replace all uses of EXIT() macro.  Use early return where possible,
use throw otherwise.
utility.h: Remove EXIT() macro.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4805 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-10-09 19:34:46 +00:00
chrfranke e391466f18 Add SPDX-License-Identifier to all files with GPL header (#919).
Remove GPL headers.  Remove outdated info about smartsuite.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4760 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-08-19 18:45:53 +00:00
chrfranke cd78662dd8 smartctl.cpp, os_win32/wmiquery.h: Add missing printf() format checks.
This also silences -Wformat-nonliteral warnings from clang++ 5.0.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4751 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-08-10 20:52:19 +00:00
chrfranke 85ce484ba3 Remove int64.h, use <inttypes.h> or <stdint.h> instead.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4746 4ea69e1a-61f1-4043-bf83-b5c94c648137
2018-08-04 19:09:46 +00:00
chrfranke c087676946 smartctl.cpp, smartctl.8.in: Rename '--json=a' to '--json=o'.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4655 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-12-13 21:43:53 +00:00
chrfranke db946c7aed smartctl.cpp: Show command line error messages in JSON output.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4654 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-12-13 21:41:05 +00:00
chrfranke 12259f8c79 json.cpp, json.h, smartctl.cpp, smartctl.8.in: Add '--json=g' option.
Outputs JSON structure suitable for grep.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4647 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-12-07 21:47:53 +00:00
chrfranke 61d0c44a75 json.cpp, json.h, smartctl.cpp, smartctl.8.in: Add '--json=s' option.
Outputs JSON object elements sorted by key.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4646 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-12-07 20:32:29 +00:00
chrfranke 47c5d2024a smartctl.cpp: Add JSON support for '--scan'.
Add similar device info to regular JSON output.
ataprint.cpp, scsiprint.cpp: Remove now duplicate "protocol" element.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4644 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-12-05 20:32:05 +00:00
chrfranke 61472c13d9 smartctl.cpp: Silence false positive warnings from clang analyzer.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4643 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-12-05 18:41:58 +00:00
chrfranke 487dcfd905 Add initial support for smartctl JSON output mode (#766):
json.cpp, json.h: New files with JSON support class.
Makefile.am, os_win32/vc14/smartctl.vcxproj*: Add new files.
ataprint.cpp: Add initial JSON support for -i, -H, -A and -l [x]error.
scsiprint.cpp: Add initial JSON support for -i and -H.
smartctl.cpp, smartctl.h: Add '-j, --json' option, global JSON object
and new print functions.
smartctl.8.in: Document new functionality.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4640 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-12-02 22:25:46 +00:00
chrfranke 43186b0d6b smartctl.cpp: Improve help text formatting.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4585 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-11-04 13:41:03 +00:00
chrfranke cfc32e3dab ataprint.cpp, ataprint.h, smartctl.cpp: Add option '-l defects' to print
ATA ACS-4 Pending Defects log (ticket #909).
smartctl.8.in: Document '-l defects'.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4572 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-10-29 14:36:00 +00:00
chrfranke 3f618c012f smartctl.cpp: Add '-g dsn' to '-x' output.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4406 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-03-11 15:12:56 +00:00
chrfranke b2062f6f41 Add options to get/set ATA DSN (Device Statistics Notification)
feature (ticket #815):
atacmds.h: Add DSN feature subcommand code.
ataprint.cpp, ataprint.h, smartctl.cpp: Add '-g/s dsn' options.
smartd.cpp: Add '-e dsn' directive.
smartctl.8.in, smartd.conf.5.in: Document the new options.

Patch was provided by Jonghwan Choi.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4402 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-03-09 20:20:48 +00:00
chrfranke 7b3dd3a605 smartctl.cpp, smartd.cpp: Fix help text for '-B' option.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4401 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-03-04 15:54:25 +00:00
chrfranke 79a3acb671 ataprint.cpp, ataprint.h, smartctl.cpp, smartctl.8.in:
Add STATUS parameter to '-n POWERMODE' option (ticket #697).

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4380 4ea69e1a-61f1-4043-bf83-b5c94c648137
2017-01-14 18:21:26 +00:00
chrfranke 4882936d8a smartctl.cpp: Reduce scope of 'persistent' flag (cppcheck: variableScope).
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4334 4ea69e1a-61f1-4043-bf83-b5c94c648137
2016-08-17 21:37:48 +00:00
chrfranke fc87f2ef6b ataprint.cpp, ataprint.h, smartctl.cpp, smartctl.8.in:
Add persistent option ',p' to '-s wcreorder,on|off' (ticket #726).

Patch was provided by Song Liu.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4333 4ea69e1a-61f1-4043-bf83-b5c94c648137
2016-08-17 21:28:11 +00:00
chrfranke 5d4c2e8551 atacmds.cpp, atacmds.h, ataprint.cpp, ataprint.h, smartctl.cpp, smartctl.8.in:
Add ability to control ATA drive write cache through SCT Feature control.
The new smartctl options are '-s wcache-sct,ata|on|off[,p]' and
'-g wcache-sct' (ticket #723).

Patch was provided by Song Liu.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4332 4ea69e1a-61f1-4043-bf83-b5c94c648137
2016-08-17 21:16:29 +00:00
chrfranke 19476d5f11 nvmeprint.cpp, nvmeprint.h, smartctl.cpp, smartctl.8.in:
Add NVMe support for 'smartctl -c'.  Print various drive and namespace
capabilites.  Remove related info from '-i' output.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4311 4ea69e1a-61f1-4043-bf83-b5c94c648137
2016-04-27 21:03:01 +00:00
chrfranke 3c67ac6224 smartctl.cpp: Allow NVMe debug messages during --scan.
Suppress "Device open changed type ..." message unless debug mode is enabled.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4302 4ea69e1a-61f1-4043-bf83-b5c94c648137
2016-04-16 21:03:34 +00:00
chrfranke cb1db81d10 Prevent drive spin up by '-n standby' check on Windows (ticket #677):
dev_interface.cpp, dev_interface.h: Add smart_device::is_powered_down().
os_win32.cpp: Add win_ata_device::is_powered_down().  Open device without
READ or WRITE access to prevent spin up.
smartctl.cpp, smartd.cpp: Add check for is_powered_down().

Patch was provided by Thomas Gatterweh.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4283 4ea69e1a-61f1-4043-bf83-b5c94c648137
2016-04-10 12:55:59 +00:00
chrfranke 891778a289 dev_interface.cpp, dev_interface.h: Add counter for objects derived from
'smart_device'.
smartctl.cpp, smartd.cpp: Print error message if any objects remain on exit.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4275 4ea69e1a-61f1-4043-bf83-b5c94c648137
2016-04-02 18:59:52 +00:00