1834586 Members
3605 Online
110069 Solutions
New Discussion

Re: Time stamp on vmstat

 
Phoi-Tack Lew
Occasional Contributor

Time stamp on vmstat

Hi there,
I would like to know if there is a possibility of attaching a time stamp on each row of vmstat. Currently, I dont see any switch that does this. Can anybody help? Thanks in advance.

Phoi-Tack Lew
2 REPLIES 2
Steven Sim Kok Leong
Honored Contributor

Re: Time stamp on vmstat

Hi,

You can write a cron script that does that every min eg.:
==
#!/sbin/sh
DATE=`date +%Y%m%d`
LOGFILE=/var/sadm/perf/vmstat.log.$DATE
touch $LOGFILE
echo "`date +%H%M` `vmstat 1 1|tail -1`" >> $LOGFILE
==
John Palmer
Honored Contributor

Re: Time stamp on vmstat

Consider changing the vmstat 1 1 call in the above to vmstat 5 2.
The former will report accumulated statistics since the box was booted whereas the latter will give you a true snapshot of the last 5 seconds.