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

@ -33,45 +33,45 @@ sub action
# Start loop
foreach my $host ( GetUserHosts(1) ) {
my($incrAge, $reasonHilite, $frequency, $lastAge, $lastAgeColor, $tempState, $tempReason, $lastXferErrors, $lastXferErrorsColor);
my($shortErr);
my @Backups = $bpc->BackupInfoRead($host);
my($incrAge, $reasonHilite, $frequency, $lastAge, $lastAgeColor, $tempState, $tempReason, $lastXferErrors, $lastXferErrorsColor);
my($shortErr);
my @Backups = $bpc->BackupInfoRead($host);
$bpc->ConfigRead($host);
%Conf = $bpc->Conf();
$bpc->ConfigRead($host);
%Conf = $bpc->Conf();
next if ( $Conf{XferMethod} eq "archive" );
next if ( !$Privileged && !CheckPermission($host) );
next if ( $Conf{XferMethod} eq "archive" );
next if ( !$Privileged && !CheckPermission($host) );
# Get frequency for this host
if ( $Conf{IncrPeriod} < $Conf{FullPeriod} ) {
$frequency = $Conf{IncrPeriod};
} else {
$frequency = $Conf{FullPeriod};
}
# Get frequency for this host
if ( $Conf{IncrPeriod} < $Conf{FullPeriod} ) {
$frequency = $Conf{IncrPeriod};
} else {
$frequency = $Conf{FullPeriod};
}
# Age
my $lastBackup = ( $Backups[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2;
$lastAge = sprintf("%.1f", (time - $Backups[$lastBackup]->{startTime}) / (24 * 3600));
# Age
my $lastBackup = ( $Backups[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2;
$lastAge = sprintf("%.1f", (time - $Backups[$lastBackup]->{startTime}) / (24 * 3600));
# Color for age
if ( $lastAge < $frequency ) {
$lastAgeColor = "MediumSeaGreen";
} else {
$lastAgeColor = "Tomato";
}
# Color for age
if ( $lastAge < $frequency ) {
$lastAgeColor = "MediumSeaGreen";
} else {
$lastAgeColor = "Tomato";
}
# Color for errors
$lastXferErrors = $Backups[@Backups-1]{xferErrs} if ( @Backups );
if ( $lastXferErrors == 0 ) {
$lastXferErrorsColor = "MediumSeaGreen";
} else {
$lastAgeColor = "Tomato";
}
# Color for errors
$lastXferErrors = $Backups[@Backups-1]{xferErrs} if ( @Backups );
if ( $lastXferErrors == 0 ) {
$lastXferErrorsColor = "MediumSeaGreen";
} else {
$lastAgeColor = "Tomato";
}
# Colors statuts
$reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}};
$reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" );
# Colors statuts
$reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}};
$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.../;

Loading…
Cancel
Save