master
Heuzef 5 years ago
parent 8940a6cfc2
commit 6950b62cfc
  1. 64
      Check.pm

@ -33,45 +33,45 @@ sub action
# Start loop # Start loop
foreach my $host ( GetUserHosts(1) ) { foreach my $host ( GetUserHosts(1) ) {
my($incrAge, $reasonHilite, $frequency, $lastAge, $lastAgeColor, $tempState, $tempReason, $lastXferErrors, $lastXferErrorsColor); my($incrAge, $reasonHilite, $frequency, $lastAge, $lastAgeColor, $tempState, $tempReason, $lastXferErrors, $lastXferErrorsColor);
my($shortErr); my($shortErr);
my @Backups = $bpc->BackupInfoRead($host); my @Backups = $bpc->BackupInfoRead($host);
$bpc->ConfigRead($host); $bpc->ConfigRead($host);
%Conf = $bpc->Conf(); %Conf = $bpc->Conf();
next if ( $Conf{XferMethod} eq "archive" ); next if ( $Conf{XferMethod} eq "archive" );
next if ( !$Privileged && !CheckPermission($host) ); next if ( !$Privileged && !CheckPermission($host) );
# Get frequency for this host # Get frequency for this host
if ( $Conf{IncrPeriod} < $Conf{FullPeriod} ) { if ( $Conf{IncrPeriod} < $Conf{FullPeriod} ) {
$frequency = $Conf{IncrPeriod}; $frequency = $Conf{IncrPeriod};
} else { } else {
$frequency = $Conf{FullPeriod}; $frequency = $Conf{FullPeriod};
} }
# Age # Age
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
if ( $lastAge < $frequency ) { if ( $lastAge < $frequency ) {
$lastAgeColor = "MediumSeaGreen"; $lastAgeColor = "MediumSeaGreen";
} else { } else {
$lastAgeColor = "Tomato"; $lastAgeColor = "Tomato";
} }
# Color for errors # Color for errors
$lastXferErrors = $Backups[@Backups-1]{xferErrs} if ( @Backups ); $lastXferErrors = $Backups[@Backups-1]{xferErrs} if ( @Backups );
if ( $lastXferErrors == 0 ) { if ( $lastXferErrors == 0 ) {
$lastXferErrorsColor = "MediumSeaGreen"; $lastXferErrorsColor = "MediumSeaGreen";
} else { } else {
$lastAgeColor = "Tomato"; $lastAgeColor = "Tomato";
} }
# Colors statuts # Colors statuts
$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 "" );
if ( $tempState ne "Status_backup_in_progress" && $tempState ne "Status_restore_in_progress" && $Conf{BackupsDisable} == 0 && $Status{$host}{error} 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 = $Status{$host}{error}) =~ s/(.{48}).*/$1.../;

Loading…
Cancel
Save