#!/bin/bash
##################
#System Auto Report
#Author:hx10
##################
LANG=en_US
NUM=` echo -------------`
DIR=`pwd`
HOST=`hostname`
CPU=`top -n 1 |grep Cpu |awk '{print $2}'|awk -F us, '{print $1}'`
DATE=$(/bin/date -d "today" +"%Y-%m-%d    %H:%M:%S")
MEMORY=`free -m |grep "buffers/cache"|awk '{print "used:"$3"M" "   free:"$4"M"}'`
SWAP=`free -m | grep Swap |awk '{print "used:"$3"M" "   free:"$4"M"}'`
ADDR=`/sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{print $2;}' | awk -F':' '{print $2;}'`
DISK=$(df -h |awk '{print $6"\t"$5"\t"$2"\t"$4"\t"$3"\t"}'|grep -v /monitor|grep -v /media)
LOAD=`top -n 1 |grep "load average:" |awk '{print$12$13$14}'`
output="
`echo "###################################################################"`\n
Date:$DATE\n
Hostname:$HOST\n
IP Address:$ADDR\n
CPU Usage:$CPU\n
Memory Uasge:$MEMORY\n
Swap Uasge:$SWAP\n
Load Balance:$LOAD\n
Disk Usage:"
echo -e $output >>/$DIR/system.log
df -h |grep -v 'mnt'|grep -v 'monitor'|grep -v ':'|grep -v 'tmpfs'>>/$DIR/system.log
exit 0