Inventory Script
Use this one all the time, it relies mostly on dmidecode output and keeps it very nicely organized for a database use case later in the process. Meanwhile here is a helpful inventory bash script to get your assets in order.
#!/bin/bash
#SSH="/usr/bin/ssh"
#_CMD="$SSH admin@$1 sudo "
_CMD="sudo"
shostname="$($_CMD /bin/hostname)"
smakemodel="$($_CMD /usr/sbin/dmidecode |grep "Product Name" |cut -d: -f2 |head -1)"
rtotalram="$($_CMD /bin/cat /proc/meminfo |grep MemTotal |awk '{printf("%0.f\n", $2/ 1024)}')"
numcpus="$($_CMD /usr/sbin/dmidecode -t processor |grep -i Version:|wc -l)"
corepercpu="$($_CMD /usr/sbin/dmidecode -t processor |grep "Core Count:" |awk '{print $3}' |head -1)"
cpuspeed="$($_CMD /usr/sbin/dmidecode -t processor |grep -i "Current Speed" |awk '{print $3,$4}' |head -1)"
echo "HOSTNAME|MAKEMODEL|MEM(MB)|CPU NUM|CPU SPEED|CPU NUM CORES"
echo "$shostname|${smakemodel}|${rtotalram}|${numcpus}|${corepercpu}|${cpuspeed}"
If you are just looking for a dmidecode script that will get you one of the basics
#!/bin/bash
ssh admin@$1 "sudo /usr/sbin/dmidecode -t 1 | egrep '(Serial Number|Product Name)'"
Learn more on the fundamentals of bash programming https://www.shellscript.sh/functions.html