2010/05/27
vmstat with timestamp
How to insert time stamp
1.Create the following simple timestamp.pl
# vi timestamp.pl
#!/usr/bin/perl
while (<>) { print localtime() . ": $_"; }
2. Run vmstat and pipe the output to timestamp.pl
# chmod 755 timestamp.pl
# vmstat 1 5 | ./timestamp.pl
Tue Dec 8 16:54:14 2009: kthr memory page
disk faults cpu
Tue Dec 8 16:54:14 2009: r b w swap free re mf pi po fr de sr m0
m1 m4 m5 in sy cs us sy id
Tue Dec 8 16:54:14 2009: 0 0 0 7506072 518520 52 102 65 4 4 0 0 1
8 0 2 1551 3179 3610 2 2 96
Tue Dec 8 16:54:15 2009: 0 0 0 7158824 237504 113 238 155 0 0 0 0 421
0 0 2 495 1120 1154 1 2 98
Tue Dec 8 16:54:16 2009: 0 0 0 7158824 237416 2 2 0 0 0 0 0 0
0 0 0 359 797 789 1 0 99
Tue Dec 8 16:54:17 2009: 0 0 0 7158824 237400 36 42 0 0 0 0 0 0
0 0 0 513 740 1149 0 1 99
Tue Dec 8 16:54:18 2009: 0 0 0 7158824 237248 2 2 0 0 0 0 0 0
0 0 0 356 611 729 1 1 98