2021-04-11 13:03:10 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
CPU=$(cat /proc/cpuinfo | grep 'model name' | uniq | awk -F: '{print $2}' | sed 's/(R)//g')
|
|
|
|
NUMCPU=$(cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l)
|
2022-09-07 10:29:21 +08:00
|
|
|
MEM=$(cat /proc/meminfo | awk '/MemTotal/ {print $(NF-1)/1024/1024}')
|
2021-04-11 13:03:10 +08:00
|
|
|
DISK=$(for d in /dev/sd? /dev/nvme?n? /dev/vd? /dev/hd?; do blockdev --getsize64 $d 2>/dev/null | awk '{print $1}'; done | awk '{SUM+=$1}; END {print SUM/1024/1024/1024}')
|
|
|
|
SERIAL=$(dmidecode -t system | awk -F: '/Serial/ {print $2}')
|
|
|
|
|
|
|
|
echo "{"
|
|
|
|
echo \"Hostname\": \"$(hostname -s)\",
|
|
|
|
echo \"Cpu\": \"$CPU\",
|
|
|
|
echo \"NumCpu\": \"$NUMCPU\",
|
|
|
|
echo \"Mem\": \"$MEM\",
|
|
|
|
echo \"Disk\": \"$DISK\",
|
|
|
|
echo \"Serial\": \"$SERIAL\"
|
|
|
|
echo "}"
|
|
|
|
|
|
|
|
|