Also, sowas geht bei mir 1a:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use strict;
use warnings;
my $cmd = '/usr/bin/vmstat 1 10|';
open(my $fh, $cmd)
or die "Error executing vmstat: $!";
while ( my $line = <$fh> ) {
print $line;
print '-' x 70, "\n";
}
close($fh);
Das ergibt folgendes:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
----------------------------------------------------------------------
r b swpd free buff cache si so bi bo in cs us sy id wa
----------------------------------------------------------------------
1 0 64 954680 35300 272440 0 0 11 18 43 21 3 0 97 0
----------------------------------------------------------------------
0 0 64 954176 35300 272440 0 0 0 0 1082 397 3 0 97 0
----------------------------------------------------------------------
0 0 64 954176 35300 272440 0 0 0 0 1084 397 1 0 99 0
----------------------------------------------------------------------
1 0 64 954176 35308 272440 0 0 0 48 1084 388 1 1 97 1
----------------------------------------------------------------------
0 0 64 954208 35308 272440 0 0 0 0 1084 398 2 0 98 0
----------------------------------------------------------------------
0 0 64 954208 35308 272440 0 0 0 0 1081 378 1 0 99 0
----------------------------------------------------------------------
1 0 64 954208 35308 272440 0 0 0 0 1084 395 1 1 98 0
----------------------------------------------------------------------
0 0 64 954208 35308 272440 0 0 0 0 1081 375 2 0 98 0
----------------------------------------------------------------------
0 0 64 954224 35308 272440 0 0 0 0 1084 400 1 0 99 0
----------------------------------------------------------------------
0 0 64 954224 35308 272440 0 0 0 0 1081 362 2 0 98 0
----------------------------------------------------------------------