Mpstat.sh

From PeformIQ Upgrade
Revision as of 13:54, 3 March 2015 by PeterHarding (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 &

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