#!/bin/bash
date=`date +%F-%T`
name="$date system information check"
system_ver=`cat /etc/redhat-release|sed 's/[ ]/_/g'`
kernel_ver=`uname -r`
hostname=`echo $HOSTNAME`
ip=`ip add | grep -v inet6 |grep inet |awk '{print $2,$NF}'|grep -v lo`
mem_used=`free -m |grep Mem |awk '{print $3/$2*100"%"}'`
swap_used=`free -m |grep Swap |awk '{print $3/$2*100"%"}'`
disk_used=`df -TPh|awk '{print $6,$7}' |grep -v Use`
load1=`cat /proc/loadavg | awk '{print $1}'`
load5=`cat /proc/loadavg | awk '{print $2}'`
load15=`cat /proc/loadavg | awk '{print $3}'`
loadavg=`cat /proc/loadavg|awk '{print ($1+$2+$3)/3*100}'`
cpu_us=`vmstat | awk '{print $13}'|grep -v us`
cpu_sy=`vmstat | awk '{print $14}'|grep -v sy`
run_time=` uptime | awk -F, '{print $1}' |awk '{print $2,$3,$4}'`
echo
echo "*************************************************"
echo "$name"
echo "*************************************************"
printf "system version:\t%s\n" $system_ver
printf "kernel version:\t%s\n" $kernel_ver
printf "hostname:\t%s\n" $hostname
echo "ipaddress:$ip"
echo "********************MEMORY************************"
printf "memory used:\t%s\n" $mem_used
printf "swap used:\t%s\n" $swap_used
echo "********************DISK USED*************************"
echo "$disk_used"
echo "********************CPU***************************"
printf "CPU_load1:\t%s\n" $load1
printf "CPU_load5:\t%s\n" $load5
printf "CPU_load15:\t%s\n" $load15
printf "CPU_loadavg:\t%s\n" $loadavg
printf "CPU_us:\t%s\n" $cpu_us
printf "CPU_sy:\t%s\n" $cpu_sy
echo "***************RUN TIME***************************"
echo "running time: $run_time"
echo "***************************************************"