Skip to content

Instantly share code, notes, and snippets.

@maxux
Last active December 9, 2018 20:32
Show Gist options
  • Save maxux/db510fc2d5bdec629460bd900f479b11 to your computer and use it in GitHub Desktop.
Save maxux/db510fc2d5bdec629460bd900f479b11 to your computer and use it in GitHub Desktop.
#!/bin/bash
cpu_model=$(grep 'model name' /proc/cpuinfo | awk -F': ' '{ print $2 }' | head -1)
cpu_count=$(grep 'model name' /proc/cpuinfo | awk -F': ' '{ print $2 }' | wc -l)
cpu_socket=$(lscpu -p=SOCKET | grep -v '^#' | sort -u | wc -l)
echo "=================================="
echo "== $(hostname)"
echo "=================================="
echo ""
echo "--- CPU ---"
echo "Model : $cpu_model"
echo "Sockets : $cpu_socket"
echo "Cores : $cpu_count cores"
echo ""
baseboard_brand=$(dmidecode -s baseboard-manufacturer | head -1)
baseboard_model=$(dmidecode -s baseboard-product-name | head -1)
echo "--- SYSTEM BOARD ---"
echo "Brand : $baseboard_brand"
echo "Model : $baseboard_model"
echo ""
memory_total=$(free -g | head -2 | tail -1 | awk '{ print $2 }')
memory_modules=$(dmidecode -t memory | grep 'Size:' | egrep 'MB|GB' | wc -l)
echo "--- MEMORY ---"
echo "Found : $memory_total GB"
echo "Modules : $memory_modules installed"
echo ""
echo ">>> Memory Modules [Size, Manufacturer, Serial, Part] <<<"
dmidecode -t memory | egrep 'Manufacturer:|Serial Number:|Part Number:|Size:' | egrep -v 'No Module|NO DIMM|Empty' | awk -F': ' '{ printf "%s |\n", $2 }' | paste -sd "," - | xargs -d, -n 4
echo "--- DISKS ---"
disk_count=$(lsscsi | wc -l)
echo "Found : $disk_count disks"
echo ""
echo ">>> Disks List <<<"
lsscsi
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment