This commit is contained in:
128
proxDoc.sh
128
proxDoc.sh
@@ -189,41 +189,105 @@ get_motherboard_info() {
|
|||||||
|
|
||||||
get_memory_details() {
|
get_memory_details() {
|
||||||
echo -e "\n${GREEN}=== Memory DIMM Information ===${NC}"
|
echo -e "\n${GREEN}=== Memory DIMM Information ===${NC}"
|
||||||
dmidecode -t memory | awk '
|
|
||||||
/Memory Device/,/^$/ {
|
# Use a more robust parsing approach
|
||||||
if (/Size:/ && !/No Module Installed/) {
|
local locator size type speed manufacturer
|
||||||
size=$2" "$3
|
local in_device=false
|
||||||
}
|
|
||||||
if (/Type:/ && !/Unknown/ && !/Error/) {
|
# Print header
|
||||||
type=$2
|
printf "%-12s %-12s %-10s %-12s %-20s\n" "Slot" "Size" "Type" "Speed" "Manufacturer"
|
||||||
}
|
printf "%-12s %-12s %-10s %-12s %-20s\n" "----" "----" "----" "-----" "------------"
|
||||||
if (/Speed:/ && !/Unknown/ && $2 != "Unknown") {
|
|
||||||
speed=$2" "$3
|
while IFS= read -r line; do
|
||||||
}
|
# Detect start of a memory device section
|
||||||
if (/Manufacturer:/ && !/Unknown/ && $2 != "Unknown") {
|
if [[ "$line" =~ ^Memory[[:space:]]Device ]]; then
|
||||||
mfr=$2
|
# If we have data from previous device, print it
|
||||||
}
|
if [[ -n "$locator" && -n "$size" && ! "$size" =~ (No|Not|Installed) ]]; then
|
||||||
if (/Part Number:/ && !/Unknown/) {
|
printf "%-12s %-12s %-10s %-12s %-20s\n" \
|
||||||
part=$3
|
"${locator:-N/A}" \
|
||||||
}
|
"${size:-N/A}" \
|
||||||
if (/Locator:/ && !/Bank/) {
|
"${type:-N/A}" \
|
||||||
loc=$2
|
"${speed:-N/A}" \
|
||||||
if (size && size !~ /No/) {
|
"${manufacturer:-N/A}"
|
||||||
printf "%-12s %-10s %-8s %-12s %-20s\n", loc, size, type, speed, mfr
|
fi
|
||||||
size=""; type=""; speed=""; mfr=""; part=""
|
|
||||||
}
|
# Reset variables for new device
|
||||||
}
|
locator=""
|
||||||
}
|
size=""
|
||||||
'
|
type=""
|
||||||
|
speed=""
|
||||||
|
manufacturer=""
|
||||||
|
in_device=true
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Skip if not in a device section
|
||||||
|
[[ "$in_device" != true ]] && continue
|
||||||
|
|
||||||
|
# Parse fields (case-insensitive, flexible whitespace)
|
||||||
|
if [[ "$line" =~ ^[[:space:]]*Locator:[[:space:]]*(.+)$ ]] && [[ ! "$line" =~ Bank ]]; then
|
||||||
|
locator="${BASH_REMATCH[1]}"
|
||||||
|
locator="${locator// /_}" # Replace spaces with underscores
|
||||||
|
elif [[ "$line" =~ ^[[:space:]]*Size:[[:space:]]*(.+)$ ]]; then
|
||||||
|
size="${BASH_REMATCH[1]}"
|
||||||
|
elif [[ "$line" =~ ^[[:space:]]*Type:[[:space:]]*(.+)$ ]]; then
|
||||||
|
type="${BASH_REMATCH[1]}"
|
||||||
|
# Skip if it's an error or unknown type
|
||||||
|
[[ "$type" =~ (Unknown|Error|Correction) ]] && type=""
|
||||||
|
elif [[ "$line" =~ ^[[:space:]]*Speed:[[:space:]]*(.+)$ ]]; then
|
||||||
|
speed="${BASH_REMATCH[1]}"
|
||||||
|
[[ "$speed" =~ Unknown ]] && speed=""
|
||||||
|
elif [[ "$line" =~ ^[[:space:]]*Manufacturer:[[:space:]]*(.+)$ ]]; then
|
||||||
|
manufacturer="${BASH_REMATCH[1]}"
|
||||||
|
[[ "$manufacturer" =~ (Unknown|NO DIMM) ]] && manufacturer=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Empty line marks end of device section
|
||||||
|
if [[ -z "$line" ]]; then
|
||||||
|
in_device=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
done < <(dmidecode -t memory 2>/dev/null)
|
||||||
|
|
||||||
|
# Print last device if it has data
|
||||||
|
if [[ -n "$locator" && -n "$size" && ! "$size" =~ (No|Not|Installed) ]]; then
|
||||||
|
printf "%-12s %-12s %-10s %-12s %-20s\n" \
|
||||||
|
"${locator:-N/A}" \
|
||||||
|
"${size:-N/A}" \
|
||||||
|
"${type:-N/A}" \
|
||||||
|
"${speed:-N/A}" \
|
||||||
|
"${manufacturer:-N/A}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Memory summary
|
||||||
echo -e "\n${GREEN}Memory Summary:${NC}"
|
echo -e "\n${GREEN}Memory Summary:${NC}"
|
||||||
# Count actual DIMM slots by looking for Locator entries with slot-like names (DIMM, BANK, ChannelA, etc.)
|
|
||||||
# Filter out Bank Locator lines and count unique slot names
|
# Count slots more reliably
|
||||||
local total_slots=$(dmidecode -t memory | grep -E "^\s+Locator:" | grep -v "Bank Locator" | wc -l)
|
local total_slots=0
|
||||||
# Count populated slots - those with actual size values (not "No Module Installed" or "Not Installed")
|
local populated=0
|
||||||
local populated=$(dmidecode -t memory | grep -E "^\s+Size:" | grep -v -E "No Module|Not Installed" | wc -l)
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ "$line" =~ ^[[:space:]]*Locator: ]] && [[ ! "$line" =~ Bank ]]; then
|
||||||
|
((total_slots++))
|
||||||
|
fi
|
||||||
|
done < <(dmidecode -t memory 2>/dev/null)
|
||||||
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ "$line" =~ ^[[:space:]]*Size:[[:space:]]*(.+)$ ]]; then
|
||||||
|
local size_val="${BASH_REMATCH[1]}"
|
||||||
|
if [[ ! "$size_val" =~ (No|Not|Installed) ]]; then
|
||||||
|
((populated++))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < <(dmidecode -t memory 2>/dev/null)
|
||||||
|
|
||||||
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}')"
|
|
||||||
|
# Get max capacity
|
||||||
|
local max_capacity
|
||||||
|
max_capacity=$(dmidecode -t memory 2>/dev/null | grep -i "Maximum Capacity" | head -1 | sed 's/.*: //')
|
||||||
|
echo -e " Max Capacity: ${max_capacity:-Unknown}"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_nic_details() {
|
get_nic_details() {
|
||||||
|
|||||||
Reference in New Issue
Block a user