Vmstat.sh
Revision as of 10:52, 17 April 2013 by PeterHarding (talk | contribs) (Created page with "=Automated vmstat Collector= <pre> #!/bin/sh # #-------------------------------------------------------------------------- function datetime { while read LINE ; do ...")
Automated vmstat Collector
#!/bin/sh # #-------------------------------------------------------------------------- function datetime { while read LINE ; do DATE=`date "+%Y-%m-%d %H:%M:%S"` printf "${DATE} ${LINE}\n" done } #-------------------------------------------------------------------------- HOST=`hostname | sed 's/\..*//'` #HOST=lnfsnd52 echo $HOST PERIOD=720 # Minutes DELAY=60 # Seconds #-------------------------------------------------------------------------- SECONDS=`expr $PERIOD '*' 60` CNT=`expr $SECONDS '/' $DELAY` TS_FNAME=`date "+%Y%m%d_%H%M"` TS_START=`date "+%Y-%m-%d %H:%M:%S"` LOG="${HOST}_${TS_FNAME}.vmstat" echo "Processing to file - $LOG" #-------------------------------------------------------------------------- echo "==> Count: $CNT Delay: $DELAY" > $LOG echo "==> Start: $TS_START" >> $LOG echo >> $LOG vmstat $DELAY $CNT | datetime >> $LOG & #--------------------------------------------------------------------------