Fix memory count, HBA detection, remove redundant disk health

- Fix memory slot counting: use grep on Locator/Size fields instead
  of awk pattern that wasn't matching dmidecode output correctly
- Add SATA to HBA detection patterns - was missing SATA controllers
- Remove get_disk_health from runDiags - redundant with DriveAtlas
  which shows the same info in a better format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-24 21:29:14 -05:00
parent ca23a30bd3
commit 6e3cafa98d

View File

@@ -209,10 +209,11 @@ get_memory_details() {
} }
' '
echo -e "\n${GREEN}Memory Summary:${NC}" echo -e "\n${GREEN}Memory Summary:${NC}"
# Count total memory device slots (excluding Physical Memory Array entries) # Count actual DIMM slots by looking for Locator entries with slot-like names (DIMM, BANK, ChannelA, etc.)
local total_slots=$(dmidecode -t memory | awk '/^Memory Device$/,/^$/ {if (/Size:/) count++} END {print count}') # Filter out Bank Locator lines and count unique slot names
# Count populated slots (Size: lines with actual values, not "No Module Installed") local total_slots=$(dmidecode -t memory | grep -E "^\s+Locator:" | grep -v "Bank Locator" | wc -l)
local populated=$(dmidecode -t memory | awk '/^Memory Device$/,/^$/ {if (/Size:/ && !/No Module/) count++} END {print count}') # Count populated slots - those with actual size values (not "No Module Installed" or "Not Installed")
local populated=$(dmidecode -t memory | grep -E "^\s+Size:" | grep -v -E "No Module|Not Installed" | wc -l)
echo -e " Total Slots: $total_slots" echo -e " Total Slots: $total_slots"
echo -e " Populated: $populated" echo -e " Populated: $populated"
echo -e " Max Capacity: $(dmidecode -t memory | grep "Maximum Capacity" | head -1 | awk '{print $3" "$4}')" echo -e " Max Capacity: $(dmidecode -t memory | grep "Maximum Capacity" | head -1 | awk '{print $3" "$4}')"
@@ -261,10 +262,10 @@ get_nic_details() {
get_hba_info() { get_hba_info() {
echo -e "\n${GREEN}=== HBA/Storage Controller Information ===${NC}" echo -e "\n${GREEN}=== HBA/Storage Controller Information ===${NC}"
# Find RAID, SAS, SCSI, and storage controllers # Find RAID, SAS, SATA, SCSI, and storage controllers
lspci -vmm 2>/dev/null | awk ' lspci -vmm 2>/dev/null | awk '
BEGIN { RS=""; FS="\n" } BEGIN { RS=""; FS="\n" }
/RAID|SAS|SCSI|Mass storage|Serial Attached|Fibre Channel|NVMe/ { /RAID|SAS|SATA|SCSI|Mass storage|Serial Attached|Fibre Channel|NVMe/ {
for (i=1; i<=NF; i++) { for (i=1; i<=NF; i++) {
if ($i ~ /^Slot:/) slot = substr($i, 7) if ($i ~ /^Slot:/) slot = substr($i, 7)
if ($i ~ /^Class:/) class = substr($i, 8) if ($i ~ /^Class:/) class = substr($i, 8)
@@ -283,7 +284,7 @@ get_hba_info() {
# Show detailed info for storage controllers # Show detailed info for storage controllers
echo -e "\n${GREEN}=== Storage Controller Details ===${NC}" echo -e "\n${GREEN}=== Storage Controller Details ===${NC}"
for ctrl in $(lspci | grep -iE "RAID|SAS|SCSI|Mass storage|NVMe" | awk '{print $1}'); do for ctrl in $(lspci | grep -iE "RAID|SAS|SATA|SCSI|Mass storage|NVMe" | awk '{print $1}'); do
echo -e "\n${GREEN}Controller $ctrl:${NC}" echo -e "\n${GREEN}Controller $ctrl:${NC}"
lspci -vvs "$ctrl" 2>/dev/null | grep -E "^\s+(Subsystem|LnkSta|Kernel driver)" | head -5 lspci -vvs "$ctrl" 2>/dev/null | grep -E "^\s+(Subsystem|LnkSta|Kernel driver)" | head -5
done done
@@ -476,7 +477,6 @@ runDiags() {
get_ram_info get_ram_info
get_memory_details get_memory_details
get_storage_info get_storage_info
get_disk_health
get_drive_atlas get_drive_atlas
get_network_info get_network_info
get_detailed_network get_detailed_network