10>>vmstat-uptime

#!/bin/bash
#
# Command :vmstat,uptime
#Capture_Stats - Gather System Performance Statistics
############################################################
# Set Script Variables
#
REPORT_FILE=/home/ach/data-file/vmstat-uptime.csv
DATE=`date +%m%d%Y`
TIME=`date +%k:%M:%S`
#
##############################################################
# Gather Performance Statistics
#
USERS=`uptime | sed 's/users.*$//' | gawk '{print $NF}'`
LOAD=`uptime |gawk '{print $NF}'`
#
FREE=`vmstat 1 2 | sed -n '/[0-9]/p' | sed -n '2p'|
gawk '{print $4}'`
#
IDLE=`vmstat 1 2 | sed -n '/[0-9]/p' | sed -n '2p'|
gawk '{print $15}'`
#
############################################################
#
echo $DATE $TIME $USERS $LOAD $FREE $IDLE >> $REPORT_FILE
#exec 3>&1
#exec 1> $REPORT_FILE
#echo "Time is :" $DATE -- $TIME
#echo "number of users:" $USERS
#echo "average load at last 15 minutes:" $LOAD
#echo "Free physical disk:" $FREE
#echo "Cup is free (%)" $IDLE
#exec 1>&3
#
#END

你可能感兴趣的:(vmstat)