One of the problems I have with vmstat is that it doesn't have the option to output timestamps (the way iostat does).
As a result, if you have vmstat logs and you don't know exactly when it was run or at what interval it was collecting data, then it makes the data less meaningful or makes it a hassle to track down the information.
It is easy enough to add the date, using a simple shell script. Create a file, add_date.sh, containing the following:
#!/bin/bash
while read data; do
echo `date '+%m/%d/%Y %H:%M:%S'` $data
done
Then, execute vmstat as you normally would, but piping the data through our shell scirpt, add_date.sh:
-bash-3.00$ vmstat 5 5 | ./add_date.sh 04/23/2008 10:02:38 kthr memory page disk faults cpu 04/23/2008 10:02:38 r b w swap free re mf pi po fr de sr cd cd f0 s0 in sy cs us sy id 04/23/2008 10:02:38 0 0 0 3760076 2099016 1 2 5 1 1 0 1 1 251 -0 -0 402 150 237 1 0 99 04/23/2008 10:02:43 0 0 0 3518948 2258028 10 126 0 0 0 0 0 0 0 0 0 443 207 285 0 0 100 04/23/2008 10:02:48 0 0 0 3518948 2258048 3 38 0 0 0 0 0 0 0 0 0 433 110 281 0 0 100 04/23/2008 10:02:53 0 0 0 3518948 2258048 3 38 0 0 0 0 0 0 0 0 0 422 111 273 0 1 99 04/23/2008 10:02:58 0 0 0 3518948 2258048 3 38 0 0 0 0 0 0 0 0 0 446 110 282 0 0 100
Now you have vmstat data with timestamps!
Recent comments
4 hours 37 min ago
21 hours 38 min ago
1 day 37 min ago
1 week 4 days ago
1 week 5 days ago
4 weeks 4 hours ago
5 weeks 3 days ago
10 weeks 5 days ago
11 weeks 3 days ago
11 weeks 3 days ago