mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
fixes SMART Status "unknown" in the smart widget and more... (#1429)
* fixes SMART Status "unknown" in the smart widget This fixes the "Unable to detect device typ" of smartctl, because it needs the full path to the device (e.g. /dev/ada0). As second it removes white space from start of $state variable before return, which let it match in the right way in the smart_status.widget.php. And as last the additional diskinfo command let the script skip devices, where disking exits with the error 'failed, probably not a disk.'. * replace device listing replace fixed device pattern with list of disk devices detected by kernel
This commit is contained in:
parent
8aad34a47e
commit
eb6e584beb
1 changed files with 3 additions and 2 deletions
|
|
@ -27,12 +27,13 @@
|
|||
|
||||
result=""
|
||||
|
||||
for dev in `ls /dev | grep '^\(ad\|da\|ada\)[0-9]\{1,2\}$'`; do
|
||||
for dev in `sysctl -a | grep -i kern.disks | awk -F: '{print $2}'`; do
|
||||
/usr/sbin/diskinfo $dev >/dev/null 2>&1 || continue
|
||||
ident=`/usr/sbin/diskinfo -v $dev | grep ident | awk '{print $1}'`;
|
||||
state=`/usr/local/sbin/smartctl -jH /dev/$dev`
|
||||
|
||||
if [ -n "$result" ]; then
|
||||
result="$result,";
|
||||
result="$result,";
|
||||
fi
|
||||
|
||||
result="$result{\"device\":\"$dev\",\"ident\":\"$ident\",\"state\":$state}";
|
||||
|
|
|
|||
Loading…
Reference in a new issue