|
|
|
@ -107,128 +107,128 @@ sub action |
|
|
|
|
$lastAgeColor = "Tomato"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}}; |
|
|
|
|
|
|
|
|
|
# If Backup is disable |
|
|
|
|
if ( $Conf{BackupsDisable} == 1 ) { |
|
|
|
|
if ( $Status{$host}{state} ne "Status_backup_in_progress" && $Status{$host}{state} ne "Status_restore_in_progress" ) { |
|
|
|
|
$reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_OnlyManualBackups}; |
|
|
|
|
$tempState = "Disabled_OnlyManualBackups"; |
|
|
|
|
$tempReason = ""; |
|
|
|
|
$reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}}; |
|
|
|
|
|
|
|
|
|
# If Backup is disable |
|
|
|
|
if ( $Conf{BackupsDisable} == 1 ) { |
|
|
|
|
if ( $Status{$host}{state} ne "Status_backup_in_progress" && $Status{$host}{state} ne "Status_restore_in_progress" ) { |
|
|
|
|
$reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_OnlyManualBackups}; |
|
|
|
|
$tempState = "Disabled_OnlyManualBackups"; |
|
|
|
|
$tempReason = ""; |
|
|
|
|
} else { |
|
|
|
|
$tempState = $Status{$host}{state}; |
|
|
|
|
$tempReason = $Status{$host}{reason}; |
|
|
|
|
} |
|
|
|
|
} elsif ($Conf{BackupsDisable} == 2 ) { |
|
|
|
|
$reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_AllBackupsDisabled}; |
|
|
|
|
$tempState = "Disabled_AllBackupsDisabled"; |
|
|
|
|
$tempReason = ""; |
|
|
|
|
} else { |
|
|
|
|
$tempState = $Status{$host}{state}; |
|
|
|
|
$tempReason = $Status{$host}{reason}; |
|
|
|
|
$tempState = $Status{$host}{state}; |
|
|
|
|
$tempReason = $Status{$host}{reason}; |
|
|
|
|
} |
|
|
|
|
} elsif ($Conf{BackupsDisable} == 2 ) { |
|
|
|
|
$reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_AllBackupsDisabled}; |
|
|
|
|
$tempState = "Disabled_AllBackupsDisabled"; |
|
|
|
|
$tempReason = ""; |
|
|
|
|
} else { |
|
|
|
|
$tempState = $Status{$host}{state}; |
|
|
|
|
$tempReason = $Status{$host}{reason}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" ); |
|
|
|
|
if ( $tempState ne "Status_backup_in_progress" && $tempState ne "Status_restore_in_progress" && $Conf{BackupsDisable} == 0 && $Status{$host}{error} ne "" ) { |
|
|
|
|
($shortErr = $Status{$host}{error}) =~ s/(.{48}).*/$1.../; |
|
|
|
|
$shortErr = " ($shortErr)"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Check Size Consistency |
|
|
|
|
my $mainConf = $bpc->ConfigDataRead(); |
|
|
|
|
my $check = {}; |
|
|
|
|
|
|
|
|
|
my $hostConf = $bpc->ConfigDataRead($host); |
|
|
|
|
my $conf = { %$mainConf, %$hostConf }; |
|
|
|
|
my $age = -1; |
|
|
|
|
$check = { |
|
|
|
|
bkp => 0, |
|
|
|
|
last_age => 0, |
|
|
|
|
errors => 0, |
|
|
|
|
new_size => 0, |
|
|
|
|
new_size_avg => 0, |
|
|
|
|
new_size_median => 0, |
|
|
|
|
new_size_q1 => 0, |
|
|
|
|
new_size_q3 => 0 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
my @bpc_info = $bpc->BackupInfoRead($host); |
|
|
|
|
my $sizes = new Statistics::Descriptive::Full; |
|
|
|
|
|
|
|
|
|
if ( scalar( @bpc_info ) ){ |
|
|
|
|
foreach my $backup ( @bpc_info ) { |
|
|
|
|
# Skip partial or active backups |
|
|
|
|
next if ( $backup->{type} !~ m/^full|incr$/ ); |
|
|
|
|
# Push all the sizes in our data set to compute avg sizes |
|
|
|
|
# Exclude backup N°0 as it'll always have much more new data than normal backups |
|
|
|
|
$sizes->add_data($backup->{sizeNew}) unless ( $backup->{num} == 0 ); |
|
|
|
|
$check->{bkp}++; |
|
|
|
|
$reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" ); |
|
|
|
|
if ( $tempState ne "Status_backup_in_progress" && $tempState ne "Status_restore_in_progress" && $Conf{BackupsDisable} == 0 && $Status{$host}{error} ne "" ) { |
|
|
|
|
($shortErr = $Status{$host}{error}) =~ s/(.{48}).*/$1.../; |
|
|
|
|
$shortErr = " ($shortErr)"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Ignore the last backup if it's not full or incr (which means it's either partial or active) |
|
|
|
|
my $i = ( $bpc_info[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2; |
|
|
|
|
|
|
|
|
|
$check->{errors} = $bpc_info[$i]->{xferErrs}; |
|
|
|
|
$check->{new_size} = $bpc_info[$i]->{sizeNew}; |
|
|
|
|
$check->{new_size_avg} = int $sizes->mean; |
|
|
|
|
$check->{new_size_median} = int $sizes->median; |
|
|
|
|
$check->{new_size_q1} = eval { int $sizes->quantile(1) } || 0; |
|
|
|
|
$check->{new_size_q3} = eval { int $sizes->quantile(3) } || 0; |
|
|
|
|
$check->{age} = time - $bpc_info[$i]->{startTime}; |
|
|
|
|
$check->{last_age} = sprintf("%.1f", ($check->{age}) / 84600); |
|
|
|
|
} |
|
|
|
|
# Check Size Consistency |
|
|
|
|
my $mainConf = $bpc->ConfigDataRead(); |
|
|
|
|
my $check = {}; |
|
|
|
|
|
|
|
|
|
my $hostConf = $bpc->ConfigDataRead($host); |
|
|
|
|
my $conf = { %$mainConf, %$hostConf }; |
|
|
|
|
my $age = -1; |
|
|
|
|
$check = { |
|
|
|
|
bkp => 0, |
|
|
|
|
last_age => 0, |
|
|
|
|
errors => 0, |
|
|
|
|
new_size => 0, |
|
|
|
|
new_size_avg => 0, |
|
|
|
|
new_size_median => 0, |
|
|
|
|
new_size_q1 => 0, |
|
|
|
|
new_size_q3 => 0 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
my @bpc_info = $bpc->BackupInfoRead($host); |
|
|
|
|
my $sizes = new Statistics::Descriptive::Full; |
|
|
|
|
|
|
|
|
|
if ( scalar( @bpc_info ) ){ |
|
|
|
|
foreach my $backup ( @bpc_info ) { |
|
|
|
|
# Skip partial or active backups |
|
|
|
|
next if ( $backup->{type} !~ m/^full|incr$/ ); |
|
|
|
|
# Push all the sizes in our data set to compute avg sizes |
|
|
|
|
# Exclude backup N°0 as it'll always have much more new data than normal backups |
|
|
|
|
$sizes->add_data($backup->{sizeNew}) unless ( $backup->{num} == 0 ); |
|
|
|
|
$check->{bkp}++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# TOO BIG ? |
|
|
|
|
my $toobig = "1"; |
|
|
|
|
if ( $check->{new_size} > ($check->{new_size_q3} + $check->{new_size_q3} - $check->{new_size_q1}) * 1.5 or $check->{new_size} > $check->{new_size_avg} * 6 ) { |
|
|
|
|
$toobig = "1"; |
|
|
|
|
# Ignore the last backup if it's not full or incr (which means it's either partial or active) |
|
|
|
|
my $i = ( $bpc_info[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2; |
|
|
|
|
|
|
|
|
|
$check->{errors} = $bpc_info[$i]->{xferErrs}; |
|
|
|
|
$check->{new_size} = $bpc_info[$i]->{sizeNew}; |
|
|
|
|
$check->{new_size_avg} = int $sizes->mean; |
|
|
|
|
$check->{new_size_median} = int $sizes->median; |
|
|
|
|
$check->{new_size_q1} = eval { int $sizes->quantile(1) } || 0; |
|
|
|
|
$check->{new_size_q3} = eval { int $sizes->quantile(3) } || 0; |
|
|
|
|
$check->{age} = time - $bpc_info[$i]->{startTime}; |
|
|
|
|
$check->{last_age} = sprintf("%.1f", ($check->{age}) / 84600); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# TOO BIG ? |
|
|
|
|
my $toobig = "1"; |
|
|
|
|
if ( $check->{new_size} > ($check->{new_size_q3} + $check->{new_size_q3} - $check->{new_size_q1}) * 1.5 or $check->{new_size} > $check->{new_size_avg} * 6 ) { |
|
|
|
|
$toobig = "1"; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$toobig = "0"; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$toobig = "0"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# TOO SMALL ? |
|
|
|
|
my $toosmall = "1"; |
|
|
|
|
if ( $check->{new_size} < ($check->{new_size_q1} - $check->{new_size_q3} - $check->{new_size_q1}) * 1.5 or $check->{new_size} < $check->{new_size_avg} / 3 ) { |
|
|
|
|
$toosmall = "1"; |
|
|
|
|
# TOO SMALL ? |
|
|
|
|
my $toosmall = "1"; |
|
|
|
|
if ( $check->{new_size} < ($check->{new_size_q1} - $check->{new_size_q3} - $check->{new_size_q1}) * 1.5 or $check->{new_size} < $check->{new_size_avg} / 3 ) { |
|
|
|
|
$toosmall = "1"; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$toosmall = "0"; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$toosmall = "0"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
my $sizeConsistency = "<strong>ANOMALOUS</strong>"; |
|
|
|
|
my $sizeConsistencyColor = "Tomato"; |
|
|
|
|
my $sizeConsistency = "<strong>ANOMALOUS</strong>"; |
|
|
|
|
my $sizeConsistencyColor = "Tomato"; |
|
|
|
|
|
|
|
|
|
# Get result |
|
|
|
|
if ( $toobig or $toosmall ) { |
|
|
|
|
$sizeConsistency = "<strong>ANOMALOUS</strong>"; |
|
|
|
|
$sizeConsistencyColor = "Tomato"; |
|
|
|
|
# Get result |
|
|
|
|
if ( $toobig or $toosmall ) { |
|
|
|
|
$sizeConsistency = "<strong>ANOMALOUS</strong>"; |
|
|
|
|
$sizeConsistencyColor = "Tomato"; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$sizeConsistency = "Normal"; |
|
|
|
|
$sizeConsistencyColor = "MediumSeaGreen"; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$sizeConsistency = "Normal"; |
|
|
|
|
$sizeConsistencyColor = "MediumSeaGreen"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Get URL for explore file |
|
|
|
|
my $browseFile = "?action=browse&host=$host"; |
|
|
|
|
# Get URL for explore file |
|
|
|
|
my $browseFile = "?action=browse&host=$host"; |
|
|
|
|
|
|
|
|
|
# Show summary |
|
|
|
|
$str = <<EOF; |
|
|
|
|
<tr$reasonHilite><td class="border">${HostLink($host)}</td> |
|
|
|
|
<td align="center" class="border" style="color:$lastAgeColor;">$lastAge <em>(Freq: $frequency)</em></td> |
|
|
|
|
<td align="center" class="border" style="color:$lastXferErrorsColor;">$lastXferErrors</td> |
|
|
|
|
<td align="center" class="border" style="color:$sizeConsistencyColor;">$sizeConsistency</td> |
|
|
|
|
<td align="center" class="border"><a href="$browseFile" target="_blank">Explore files ...</a></td> |
|
|
|
|
# Show summary |
|
|
|
|
$str = <<EOF; |
|
|
|
|
<tr$reasonHilite><td class="border">${HostLink($host)}</td> |
|
|
|
|
<td align="center" class="border" style="color:$lastAgeColor;">$lastAge <em>(Freq: $frequency)</em></td> |
|
|
|
|
<td align="center" class="border" style="color:$lastXferErrorsColor;">$lastXferErrors</td> |
|
|
|
|
<td align="center" class="border" style="color:$sizeConsistencyColor;">$sizeConsistency</td> |
|
|
|
|
<td align="center" class="border"><a href="$browseFile" target="_blank">Explore files ...</a></td> |
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
# Increment counter |
|
|
|
|
if ( @Backups == 0 ) { |
|
|
|
|
$hostCntNone++; |
|
|
|
|
$strNone .= $str; |
|
|
|
|
} else { |
|
|
|
|
$hostCntGood++; |
|
|
|
|
$strGood .= $str; |
|
|
|
|
} |
|
|
|
|
# Increment counter |
|
|
|
|
if ( @Backups == 0 ) { |
|
|
|
|
$hostCntNone++; |
|
|
|
|
$strNone .= $str; |
|
|
|
|
} else { |
|
|
|
|
$hostCntGood++; |
|
|
|
|
$strGood .= $str; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
# End loop |
|
|
|
|
|
|
|
|
|