-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support displaying S.M.A.R.T. status #5
Comments
@Greybane not sure if you're still looking for something along these lines but I threw this together, made available via my bin dir, then executed via howe. #!/bin/bash
# Check if smartctl is installed
command -v smartctl > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error: smartctl command not found. Please install smartmontools."
exit 1
fi
bold=$(tput bold)
yellow=$(tput setaf 3)
reset=$(tput sgr0)
# Get a list of all hard drives
drives=$(lsblk -o NAME -n -d | grep -E '^sd|^hd')
# Display assessments for each drive
output+='\nDrive\tStatus\tTemp\tCycles'
for drive in $drives; do
smartResult=$(sudo smartctl -AH /dev/$drive)
# echo $smartResult
assessment=$(sudo smartctl -AH /dev/$drive | awk '/self-assessment/{print $6}')
cycles=$(sudo smartctl -AH /dev/$drive | awk '/Power_Cycle_Count/{print $10}')
temperature=$(sudo smartctl -AH /dev/$drive | awk '/Temperature_Celsius/{print $10}')
output+="\n$yellow$drive:$reset\t$assessment\t$temperature\t$cycles"
done
echo -e $output |
I will say the advantage to this being separated from howe implementation itself, is that it's easily portable and executable standalone. |
@heyvito if interested I could take a stab at supporting this natively by leveraging this module for accessing SMART information. |
Sounds good! Feel free to open a PR! :) |
I've managed to hack something together using smartctl but It's not very pretty compared to the rest of the output.
I'd be real neat to see current status, drive hours, time of last self-test and what type (short/extended).
The text was updated successfully, but these errors were encountered: