Shell Script : Relatório de SO e Hardware

Neste post estou apresentando como fazer um script de relatório do sistema e hardware.

#!/bin/bash
echo "########################################################################################"
echo "#               SYSTEM DETAILS / HARDWARE                                              #"
echo "########################################################################################"
echo -n "Name: "
uname -n
echo ""
echo -n "IP: "
ifconfig | grep eth* | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'
echo ""
echo -n "CPUs: "
grep "physical id" /proc/cpuinfo | sort | uniq | wc -l
echo ""
echo -n "Cores: "
grep "^processor" /proc/cpuinfo | wc -l
echo -n "Processor speed (MHz): "
grep MHz /proc/cpuinfo | sort | awk '{print $NF}' | uniq -c
echo ""
echo -n "Disk(s): "
fdisk -l | grep Disk
echo ""
echo -n "Kernel: "
uname -o -r
echo ""
echo -n "OS: "
if [ -f /etc/redhat-release ]; then
    echo -n "  "
    cat /etc/redhat-release
fi
echo ""
echo -n "Memory: "
grep MemTotal /proc/meminfo | awk '{print $2,$3}'
echo ""
echo -n "Up for: "
uptime | awk '{print $3,$4,$5}'
echo ""
echo -n "Manufacturer: "
lshal | grep system.hardware | grep "vendor" | grep -v video | awk -F' '{print $2}'
echo ""
echo -n "Model: "
lshal | grep system.hardware | grep "product" | grep -v video | awk -F' '{print $2}'

Saída do script :

scriptReportSO

Outro Exemplo :

scriptReportSO2

Translate »