add timestamp to the cpu usage report log

parent 656a42e9
#!/bin/sh
CPU_USAGE=`top -bn 1 | awk 'NR>7{s+=$9} END {print s}'`
LOG_FILE=/tmp/scaling
CORES=`grep -c processor /proc/cpuinfo`
#CPU_USAGE=`sar 1 1 | awk '/Average/{print $3+$5/$CORES}'`
CPU_USAGE=`uptime | cut -d',' -f5`
TIMESTAMP=`date +%s`
#intVal=${CPU_USAGE%.*}
echo "CPU USAGE: $CPU_USAGE"
python /home/ubuntu/scale.py $CPU_USAGE
#echo $intVal
maxUsage="$(echo "$CPU_USAGE*100/$CORES" | bc)"
echo "$TIMESTAMP : CPU Usage $CPU_USAGE $maxUsage %" >> /tmp/scaling
python /home/ubuntu/scale.py $maxUsage
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment