检查是否在虚拟机上以及主机基本情况
以下是虚拟机的输出
https://www.cnblogs.com/klb561/p/10527197.html
dmidecode -s system-product-name
# OpenStack Nova
lshw -class system
# sz-mec-dev02
# description: Computer
# product: OpenStack Nova
# vendor: OpenStack Foundation
# version: 13.2.1-20190604220711
# serial: 261977f6-fc7a-49f3-954e-cf9feb70fc2c
# width: 64 bits
# capabilities: smbios-2.8 dmi-2.8 smp vsyscall32
# configuration: boot=normal family=Virtual Machine uuid=8C0EE55A-5F37-554D-8300-313E29EF58B0
# *-pnp00:00
# product: PnP device PNP0b00
# physical id: 1
# capabilities: pnp
# configuration: driver=rtc_cmos
dmesg |grep -i virtual
# [ 0.145659] Booting paravirtualized kernel on KVM
# [ 1.177345] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input4
# [ 1.178356] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input3
# [ 1.223866] systemd[1]: Detected virtualization kvm.
check core
https://www.cyberciti.biz/faq/check-how-many-cpus-are-there-in-linux-system/
echo "Number of CPU/cores online at $HOSTNAME: $(getconf _NPROCESSORS_ONLN)"
check memory
https://www.networkworld.com/article/3336174/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html
dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB"}'