Difference between revisions of "Mpstat.sh"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) (Created page with "=Automated mpstat Collector= <pre> #!/bin/sh # #-------------------------------------------------------------------------- PERIOD=720 # Minutes DELAY=60 # Seconds #----...") |
PeterHarding (talk | contribs) |
||
Line 10: | Line 10: | ||
#-------------------------------------------------------------------------- | #-------------------------------------------------------------------------- | ||
HOST=`hostname | sed 's/\..*//'` | |||
SECONDS=`expr $PERIOD '*' 60` | SECONDS=`expr $PERIOD '*' 60` | ||
CNT=`expr $SECONDS '/' $DELAY` | CNT=`expr $SECONDS '/' $DELAY` | ||
TS_FILENAME=`date '+%Y%m%d_%H%M'` | |||
LOG=" | TS_START=`date "+%Y-%m-%d %H:%M:%S"` | ||
LOG="${HOST}_${TS_FILENAME}.mpstat" | |||
#-------------------------------------------------------------------------- | #-------------------------------------------------------------------------- | ||
cd /tmp | |||
echo "==> Count: $CNT Delay: $DELAY" > $LOG | echo "==> Count: $CNT Delay: $DELAY" > $LOG | ||
echo "==> Start: $TS_START" >> $LOG | |||
date >> $LOG | date >> $LOG |
Latest revision as of 13:54, 3 March 2015
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 & #--------------------------------------------------------------------------