3 |
|
|
4 |
extends 'Frey'; |
extends 'Frey'; |
5 |
with 'Frey::Web'; |
with 'Frey::Web'; |
|
#with 'Frey::Storage'; |
|
6 |
|
|
7 |
has sar_command => ( |
has sar_command => ( |
8 |
is => 'rw', |
is => 'rw', |
24 |
my $cmd = $self->sar_command . ' ' . $opts; |
my $cmd = $self->sar_command . ' ' . $opts; |
25 |
warn "# cmd: $cmd"; |
warn "# cmd: $cmd"; |
26 |
|
|
27 |
my $date = '1970-01-01T'; |
my $date = '1970-01-01 '; |
28 |
|
|
29 |
open(my $fh, '-|', $cmd) || die "can't open pipe to $cmd $!"; |
open(my $fh, '-|', $cmd) || die "can't open pipe to $cmd $!"; |
30 |
while(<$fh>) { |
while(<$fh>) { |
31 |
chomp; |
chomp; |
32 |
|
|
33 |
if ( m{(\d\d)/(\d\d)/(\d\d\d\d)$} ) { |
if ( m{(\d\d)/(\d\d)/(\d\d\d\d)$} ) { |
34 |
$date = "$3-$1-$2T"; |
$date = "$3-$1-$2 "; |
35 |
warn "# date $date"; |
warn "# date $date"; |
36 |
next; |
next; |
37 |
} |
} |
80 |
} |
} |
81 |
|
|
82 |
return { |
return { |
83 |
|
table => 'sar', |
84 |
rows => \@rows, |
rows => \@rows, |
85 |
NAME => \@name, |
NAME => \@name, |
86 |
|
sar_command => $cmd, |
87 |
} |
} |
88 |
} |
} |
89 |
|
|
90 |
|
__PACKAGE__->meta->make_immutable; |
91 |
|
no Moose; |
92 |
|
|
93 |
1; |
1; |