line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HON::EC2::Snapshots::Monitoring; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
39020
|
use 5.006; |
|
2
|
|
|
|
|
8
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
40
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
90
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
HON::EC2::Snapshots::Monitoring - The great new HON::EC2::Snapshots::Monitoring! |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.01 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
10
|
use base 'Exporter'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
869
|
|
20
|
|
|
|
|
|
|
our @EXPORT_OK = qw/findLogsOfTheDay isLogOk/; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Several utilities functions |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 findLogsOfTheDay |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Find logs of the day |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub findLogsOfTheDay { |
35
|
4
|
|
|
4
|
1
|
22866
|
my ($refLines, $date) = @_; |
36
|
4
|
|
|
|
|
9
|
my @logsOfTheDay = (); |
37
|
4
|
|
|
|
|
6
|
my $keepLogs = 0; |
38
|
|
|
|
|
|
|
|
39
|
4
|
|
|
|
|
5
|
foreach my $line (@{$refLines}){ |
|
4
|
|
|
|
|
10
|
|
40
|
201
|
100
|
|
|
|
482
|
if ($line =~ m/Starting\s\w+\sBackup\s--\s(\d{1,2}-\d{2}-\d{4})/gi){ |
41
|
12
|
100
|
|
|
|
34
|
if ($1 eq $date) { |
42
|
4
|
|
|
|
|
8
|
$keepLogs = 1; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
201
|
100
|
|
|
|
376
|
if ($keepLogs == 1) { |
47
|
97
|
|
|
|
|
123
|
push @logsOfTheDay, $line; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
201
|
100
|
|
|
|
495
|
if ($line =~ m/Backup\sdone/gi){ |
51
|
12
|
|
|
|
|
18
|
$keepLogs = 0; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
4
|
|
|
|
|
44
|
return @logsOfTheDay; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 isLogOk |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Verify specific part of the log |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub isLogOk { |
64
|
4
|
|
|
4
|
1
|
3033
|
my @lines = @_; |
65
|
4
|
|
|
|
|
6
|
my $isSnapshot = 0; |
66
|
4
|
|
|
|
|
7
|
my $isTagging = 0; |
67
|
4
|
|
|
|
|
4
|
my $isPurging = 0; |
68
|
4
|
|
|
|
|
6
|
my $isPurgeAfter = 0; |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
7
|
foreach my $line (@lines){ |
71
|
97
|
100
|
|
|
|
191
|
if ($line =~ m/^Snapshots\staken\sby\sec2-automate-backup-awscli\.sh/gi){ |
72
|
3
|
|
|
|
|
6
|
$isSnapshot = 1; |
73
|
|
|
|
|
|
|
} |
74
|
97
|
100
|
|
|
|
229
|
if ($line =~ m/Tagging\sSnapshot\ssnap-/gi){ |
75
|
4
|
|
|
|
|
7
|
$isTagging = 1; |
76
|
|
|
|
|
|
|
} |
77
|
97
|
100
|
|
|
|
204
|
if ($line =~m/Snapshot\sPurging\sis/gi){ |
78
|
2
|
|
|
|
|
3
|
$isPurging = 1; |
79
|
|
|
|
|
|
|
} |
80
|
97
|
100
|
|
|
|
226
|
if ($line =~m/PurgeAfterFE\sdate/gi){ |
81
|
4
|
|
|
|
|
8
|
$isPurgeAfter = 1; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
4
|
|
100
|
|
|
45
|
return ($isSnapshot and $isTagging and $isPurging and $isPurgeAfter); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
William Belle, C<< >> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 BUGS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
95
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
96
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SUPPORT |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
perldoc HON::EC2::Snapshots::Monitoring |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
You can also look for information at: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over 4 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * CPAN Ratings |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * Search CPAN |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Copyright 2015 William Belle. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
139
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
140
|
|
|
|
|
|
|
the Free Software Foundation; version 2 dated June, 1991 or at your option |
141
|
|
|
|
|
|
|
any later version. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
144
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
145
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
146
|
|
|
|
|
|
|
GNU General Public License for more details. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
A copy of the GNU General Public License is available in the source tree; |
149
|
|
|
|
|
|
|
if not, write to the Free Software Foundation, Inc., |
150
|
|
|
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; # End of HON::EC2::Snapshots::Monitoring |