| 1 | package HON::EC2::Snapshots::Monitoring; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | 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 | ▶ | my ($refLines, $date) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findLogsOfTheDay: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | my @logsOfTheDay = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | my $keepLogs = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | foreach my $line (@{$refLines}){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 201 | ▶ | if ($line =~ m/Starting\s\w+\sBackup\s--\s(\d{1,2}-\d{2}-\d{4})/gi){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 12 | ▶ | if ($1 eq $date) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | $keepLogs = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 201 | ▶ | if ($keepLogs == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 97 | push @logsOfTheDay, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 201 | ▶ | if ($line =~ m/Backup\sdone/gi){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 12 | $keepLogs = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | return @logsOfTheDay; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =head2 isLogOk | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | Verify specific part of the log | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | sub isLogOk { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | ▶ | my @lines = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isLogOk: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 4 | my $isSnapshot = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | my $isTagging = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 4 | my $isPurging = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 4 | my $isPurgeAfter = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 4 | foreach my $line (@lines){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 97 | ▶ | if ($line =~ m/^Snapshots\staken\sby\sec2-automate-backup-awscli\.sh/gi){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | $isSnapshot = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 97 | ▶ | if ($line =~ m/Tagging\sSnapshot\ssnap-/gi){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 4 | $isTagging = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 97 | ▶ | if ($line =~m/Snapshot\sPurging\sis/gi){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | $isPurging = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 97 | ▶ | if ($line =~m/PurgeAfterFE\sdate/gi){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 4 | $isPurgeAfter = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 4 | ▶ | return ($isSnapshot and $isTagging and $isPurging and $isPurgeAfter); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
$isSnapshot && $isTagging && $isPurging && $isPurgeAfter
$isSnapshot and $isTagging and $isPurging
$isSnapshot and $isTagging
MC/DC75%3/4
$isSnapshot && $isTagging && $isPurging && $isPurgeAfter
$isSnapshot
$isTagging
$isPurging
$isPurgeAfter
Truth table80%4/5
A and B and C && D
A= $isSnapshotB= $isTaggingC= $isPurgingD= $isPurgeAfter
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | William Belle, C<< <william.belle at gmail.com> >> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | Please report any bugs or feature requests to C<bug-hon-ec2-snapshots-monitoring at rt.cpan.org>, or through | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HON-EC2-Snapshots-Monitoring>. 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<http://rt.cpan.org/NoAuth/Bugs.html?Dist=HON-EC2-Snapshots-Monitoring> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | L<http://annocpan.org/dist/HON-EC2-Snapshots-Monitoring> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | L<http://cpanratings.perl.org/d/HON-EC2-Snapshots-Monitoring> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | L<http://search.cpan.org/dist/HON-EC2-Snapshots-Monitoring/> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 2 | 1; # End of HON::EC2::Snapshots::Monitoring | |||||||||||||||||||||||||||||||||||||||||||||||||