1 #!/bin/bash 2 # 3 # Command :vmstat,uptime 4 #Capture_Stats - Gather System Performance Statistics 5 ############################################################ 6 # Set Script Variables 7 # 8 REPORT_FILE=/home/ach/data-file/vmstat-uptime.csv 9 DATE=`date +%m%d%Y` 10 TIME=`date +%k:%M:%S` 11 # 12 ############################################################## 13 # Gather Performance Statistics 14 # 15 USERS=`uptime | sed 's/users.*$//' | gawk '{print $NF}'` 16 LOAD=`uptime |gawk '{print $NF}'` 17 # 18 FREE=`vmstat 1 2 | sed -n '/[0-9]/p' | sed -n '2p'| 19 gawk '{print $4}'` 20 # 21 IDLE=`vmstat 1 2 | sed -n '/[0-9]/p' | sed -n '2p'| 22 gawk '{print $15}'` 23 # 24 ############################################################ 25 # 26 echo $DATE $TIME $USERS $LOAD $FREE $IDLE >> $REPORT_FILE 27 #exec 3>&1 28 #exec 1> $REPORT_FILE 29 #echo "Time is :" $DATE -- $TIME 30 #echo "number of users:" $USERS 31 #echo "average load at last 15 minutes:" $LOAD 32 #echo "Free physical disk:" $FREE 33 #echo "Cup is free (%)" $IDLE 34 #exec 1>&3 35 # 36 #END