Skip to content

Commit 1ecb74a

Browse files
Added dmesg check to health-check script.
1 parent 64435e0 commit 1ecb74a

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

health-check.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,30 @@ for dev in $(ls /dev | grep -E "^sd[a-z]$"); do
333333
echo "[$device | $serial] SSD spare blocks low: $reserved%"
334334
fi
335335
done
336+
337+
#!/bin/bash
338+
# Check for hardware-related problems in dmesg output
339+
340+
# List of keywords that usually indicate hardware issues
341+
keywords=("I/O error" "failed" "hardware error" "buffer I/O" "uncorrectable" "CRC error" "sense key" "end_request" "link reset" "error handler" "device offlined" "S.M.A.R.T. error")
342+
343+
# Get recent dmesg output
344+
dmesg_output=$(dmesg --ctime --color=never 2>/dev/null)
345+
346+
# Initialize flag
347+
found_issue=false
348+
349+
# Search for each keyword (case-insensitive)
350+
for kw in "${keywords[@]}"; do
351+
if echo "$dmesg_output" | grep -i -q "$kw"; then
352+
echo "⚠️ Possible hardware issue detected: \"$kw\" found in dmesg logs"
353+
found_issue=true
354+
fi
355+
done
356+
357+
# If no issues found, print confirmation
358+
if [ "$found_issue" = false ]; then
359+
echo "✅ No hardware-related problems detected in dmesg output."
360+
else
361+
echo "🔍 Review 'dmesg' output above for details. Recommend checking SMART data or system health."
362+
fi

0 commit comments

Comments
 (0)