[smartmontools-support] feature request: more json output please

Christian Franke Christian.Franke at t-online.de
Tue Sep 13 18:48:40 CEST 2022


Stefan K wrote:
> the "new" json output is really great, with that its easier to monitor harddisk. But I still need the path to the devices, but --scan(-open) scans already the devices, so why not show the complete ouput? Or why I can't combine parameters like:
> smartctl --scan-open -j -a
> which shows all harddisk which are supported by smartctl with all informations he got.

It is not planned to implemented this in the near future.

This script runs smartctl for each device from --scan result and prints 
all outputs as one JSON array. Pass e.g. '-x' as argument:

#!/bin/sh
status=0
first=true
echo "["
for dev in $(smartctl --scan | sed -n 's,^\(/[^ ]*\).*$,\1,p'); do
   if $first; then first=false; else echo "  ,"; fi
   out=$(smartctl -j "$@" "$dev")
   status=$((status | $?))
   echo "$out" | sed 's,^,  ,'
done
echo "]"
exit $status

Regards,
Christian



More information about the Smartmontools-support mailing list