disk-smart: Show smartctl output on failure
Describe the solution you'd like
Currently, if the smartctl command fails during the disk-check, an error message such as this will be shown:
smartctl failed with exit status "Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode."
This is a very unhelpful error. I am aware of the --test arg, but this requires me to log into the machine and manually retrieve the info. I propose a new flag, --smartctl-stderr to print the command's output on an error so it shows up in the Icinga2 interface. Something like this:
smartctl failed with exit status "Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode."
stdout: smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.74-1-pve] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
Read Device Identity failed: scsi error unsupported field in scsi command
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
stderr:
In this example, the error message is caused by an external USB hard drive that doesn't support smart.
Additional context
No response
I could submit a PR for this feature but I'd like some input from the team first.
Hm, why not use the --ignore parameter? ./disk-smart --ignore sdc