Fix indents et add more comment

master
heuzef 4 years ago
parent 55aed3c076
commit 7bae703c35
  1. 18
      Check.pm

@ -53,14 +53,14 @@ sub action
$frequency = $Conf{FullPeriod}; $frequency = $Conf{FullPeriod};
} }
# ID # Get ID of last backup
my $idBackup = $Backups[@Backups-1]->{num} if ( @Backups ); my $idBackup = $Backups[@Backups-1]->{num} if ( @Backups );
# Age # Get age of last backup
my $lastBackup = ( $Backups[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2; my $lastBackup = ( $Backups[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2;
$lastAge = sprintf("%.1f", (time - $Backups[$lastBackup]->{startTime}) / (24 * 3600)); $lastAge = sprintf("%.1f", (time - $Backups[$lastBackup]->{startTime}) / (24 * 3600));
# Color for age # Color for age old
if ( $lastAge < $frequency ) { if ( $lastAge < $frequency ) {
$lastAgeColor = "MediumSeaGreen"; $lastAgeColor = "MediumSeaGreen";
} else { } else {
@ -78,7 +78,7 @@ sub action
$ifErrors = "| <a href=\"$browseErrors\" target=\"_blank\"><strong>Read me !</strong></a>"; $ifErrors = "| <a href=\"$browseErrors\" target=\"_blank\"><strong>Read me !</strong></a>";
} }
# Colors statuts # Colors statuts of backup
$reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}}; $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}};
$reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" ); $reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" );
@ -105,23 +105,23 @@ sub action
$new_size_q3 = eval { int $sizes->quantile(3) } || 0; $new_size_q3 = eval { int $sizes->quantile(3) } || 0;
} }
# Using a mathematical formula to calculate the consistency of the average size, for new files, on all backups # Using a mathematical formula to calculate the consistency of the average size, for new files, on all backups :
my $toobig = 0; my $toobig = 0;
my $toosmall = 0; my $toosmall = 0;
my $sizeConsistencyColor = "Tomato"; my $sizeConsistencyColor = "Tomato";
my $sizeConsistency = "<strong>ANOMALOUS</strong>"; my $sizeConsistency = "<strong>ANOMALOUS</strong>";
# TOO BIG ? If the size is 3 times higher than usual : # Too big ? If the size is 3 times higher than usual :
if ( $new_size > ($new_size_q3 + ($new_size_q3 - $new_size_q1) ) * 1.5 and $new_size > $new_size_avg * 3 ) { if ( $new_size > ($new_size_q3 + ($new_size_q3 - $new_size_q1) ) * 1.5 and $new_size > $new_size_avg * 3 ) {
$toobig = 1; $toobig = 1;
} }
# TOO SMALL ? If the size is 3 times lower than usual : # Too small ? If the size is 3 times lower than usual :
if ( $new_size < ($new_size_q1 - ($new_size_q3 - $new_size_q1) ) * 1.5 and $new_size < $new_size_avg / 3 ) { if ( $new_size < ($new_size_q1 - ($new_size_q3 - $new_size_q1) ) * 1.5 and $new_size < $new_size_avg / 3 ) {
$toosmall = 1; $toosmall = 1;
} }
# Get result # Get result, if we don't have enough backup (< 4) we can't calcul a realist average
if ( not $idBackup > 4) { if ( not $idBackup > 4) {
$sizeConsistencyColor = "Gray"; $sizeConsistencyColor = "Gray";
$sizeConsistency = "Not enough backups"; $sizeConsistency = "Not enough backups";
@ -180,7 +180,7 @@ EOF
</table> </table>
EOF EOF
# Show page
my $content = eval ("qq{$header}"); my $content = eval ("qq{$header}");
Header("BackupPC: Check", $content); Header("BackupPC: Check", $content);
Trailer(); Trailer();

Loading…
Cancel
Save