diff --git a/modules/performance/hardware-health-check.sh b/modules/performance/hardware-health-check.sh index 017ffd0..a615801 100755 --- a/modules/performance/hardware-health-check.sh +++ b/modules/performance/hardware-health-check.sh @@ -140,6 +140,11 @@ After installing, run: systemctl enable smartd && systemctl start smartd" local healthy_count=0 local warning_count=0 local failed_count=0 + local skipped_count=0 + local skipped_raid=0 + local skipped_virtual=0 + local skipped_lvm=0 + local skipped_other=0 for disk in $disks; do disk_count=$((disk_count + 1)) @@ -152,12 +157,16 @@ After installing, run: systemctl enable smartd && systemctl start smartd" # 1. CHECK: Device exists and smartctl can communicate if echo "$device_info" | grep -qiE "No such device|open device.*failed|Permission denied"; then echo -e "${CYAN}[INFO]${NC} Skipping $disk (device not accessible)" + skipped_count=$((skipped_count + 1)) + skipped_other=$((skipped_other + 1)) continue fi # 2. CHECK: SMART support availability if echo "$device_info" | grep -qiE "SMART support is:.*Unavailable|SMART support is:.*Disabled|Unable to detect device type"; then echo -e "${CYAN}[INFO]${NC} Skipping $disk (SMART not supported or disabled)" + skipped_count=$((skipped_count + 1)) + skipped_other=$((skipped_other + 1)) continue fi @@ -198,6 +207,8 @@ After installing, run: systemctl enable smartd && systemctl start smartd" fi echo -e "${CYAN}[INFO]${NC} Skipping $disk ($raid_type: $model)" + skipped_count=$((skipped_count + 1)) + skipped_raid=$((skipped_raid + 1)) add_finding "INFO" "ℹ️ $raid_type Detected: $disk" \ "Device: $disk Controller: $model @@ -238,6 +249,8 @@ Check controller logs and status for drive failures." \ fi echo -e "${CYAN}[INFO]${NC} Skipping $disk ($virt_type)" + skipped_count=$((skipped_count + 1)) + skipped_virtual=$((skipped_virtual + 1)) # Already handled by VM detection at start of function continue fi @@ -245,6 +258,8 @@ Check controller logs and status for drive failures." \ # 6. DETECT: Software RAID / LVM / Device Mapper if echo "$disk" | grep -qE "md[0-9]|dm-[0-9]"; then echo -e "${CYAN}[INFO]${NC} Skipping $disk (software RAID/LVM device)" + skipped_count=$((skipped_count + 1)) + skipped_lvm=$((skipped_lvm + 1)) add_finding "INFO" "ℹ️ Software RAID/LVM Detected: $disk" \ "Device: $disk Type: Software RAID or LVM logical volume @@ -267,6 +282,8 @@ For LVM (dm- devices): # 7. DETECT: Loop devices, RAM disks, other special devices if echo "$disk" | grep -qE "loop|ram|zram|nbd"; then echo -e "${CYAN}[INFO]${NC} Skipping $disk (special device: loop/ram/network)" + skipped_count=$((skipped_count + 1)) + skipped_other=$((skipped_other + 1)) continue fi @@ -274,6 +291,8 @@ For LVM (dm- devices): # Try to get SMART attributes - if this fails, skip if ! smartctl -A "$disk" &>/dev/null; then echo -e "${CYAN}[INFO]${NC} Skipping $disk (no SMART attributes available)" + skipped_count=$((skipped_count + 1)) + skipped_other=$((skipped_other + 1)) add_finding "INFO" "ℹ️ Device Without SMART: $disk" \ "Device: $disk Model: ${model:-Unknown} @@ -538,12 +557,33 @@ SMART Attributes: fi done - # Summary finding + # Summary finding with skip breakdown + local summary_details="Total devices found: $disk_count +Physical disks monitored: $healthy_count healthy, $warning_count warning, $failed_count failed" + + if [ "$skipped_count" -gt 0 ]; then + summary_details="${summary_details} +Devices skipped (SMART not applicable): $skipped_count" + if [ "$skipped_raid" -gt 0 ]; then + summary_details="${summary_details} + • Hardware RAID controllers: $skipped_raid (use vendor tools)" + fi + if [ "$skipped_lvm" -gt 0 ]; then + summary_details="${summary_details} + • Software RAID/LVM: $skipped_lvm (monitor underlying disks)" + fi + if [ "$skipped_virtual" -gt 0 ]; then + summary_details="${summary_details} + • Virtual/cloud disks: $skipped_virtual (managed by hypervisor)" + fi + if [ "$skipped_other" -gt 0 ]; then + summary_details="${summary_details} + • Other (USB/special): $skipped_other (see findings for details)" + fi + fi + add_finding "INFO" "Disk Health Summary" \ - "Total disks checked: $disk_count -Healthy: $healthy_count -Warning: $warning_count -Failed: $failed_count" \ + "$summary_details" \ "Regular SMART monitoring recommended: smartctl -a /dev/[disk]" }