Mpstat.sh

From PeformIQ Upgrade
Jump to navigation Jump to search

Automated mpstat Collector

#!/bin/sh
#
#--------------------------------------------------------------------------

PERIOD=720  # Minutes
DELAY=60    # Seconds

#--------------------------------------------------------------------------

HOST=`hostname | sed 's/\..*//'`

SECONDS=`expr $PERIOD '*' 60`
CNT=`expr $SECONDS '/' $DELAY`

TS_FILENAME=`date '+%Y%m%d_%H%M'`
TS_START=`date "+%Y-%m-%d %H:%M:%S"`

LOG="${HOST}_${TS_FILENAME}.mpstat"

#--------------------------------------------------------------------------

cd /tmp

echo "==> Count: $CNT   Delay: $DELAY"   >  $LOG
echo "==> Start: $TS_START"              >> $LOG

date                                     >> $LOG
mpstat $DELAY $CNT                       >> $LOG &

#--------------------------------------------------------------------------