timestamp vmstat PDF Print E-mail
Written by Juzzy   
Friday, 25 March 2011 09:33

here's a little script if you've ever wanted to timestamp vmstat and let it run overnight or for extended periods of time:

#!/bin/bash

if [ "$1" == "-h" ]; then echo "usage $0 [delay in seconds]"; exit; fi
if [ $# == "1" ]; then
        delay=$1
else
        delay=1
fi

#print every XX lines
print=30
i=0

while true; do
        date=`date +%m/%d\ %H:%M:%S`
        if [ $(($i % $print)) -eq 0 ]; then
                vmstat | while read line $l; do
                        echo "$date - $line"
                done
        else
                echo -n "$date -"
                vmstat | tail -n 1
        fi
        i=$(($i + 1))
        sleep $delay
done
 
Last Updated on Friday, 25 March 2011 09:39
 
Juzzy's Free Files, Powered by Joomla!; Joomla templates by SG web hosting