From 32feacceda428024dc6f508ef0b63b4acbd3361c Mon Sep 17 00:00:00 2001 From: Heuzef Date: Fri, 25 Oct 2019 16:40:03 +0200 Subject: [PATCH] add arrow --- Check.pm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Check.pm b/Check.pm index de3d21f..9c5936e 100644 --- a/Check.pm +++ b/Check.pm @@ -29,16 +29,16 @@ sub action my($str, $strGood, $header); GetStatusInfo("hosts info"); my $Privileged = CheckPermission(); - my $bpc = BackupPC::Libnew(); + my $bpc = BackupPC::Lib->new(); # Start loop foreach my $host ( GetUserHosts(1) ) { my($incrAge, $reasonHilite, $frequency, $lastAge, $lastAgeColor, $tempState, $tempReason, $lastXferErrors, $lastXferErrorsColor); my($shortErr); - my @Backups = $bpcBackupInfoRead($host); + my @Backups = $bpc->BackupInfoRead($host); - $bpcConfigRead($host); - %Conf = $bpcConf(); + $bpc->ConfigRead($host); + %Conf = $bpc->Conf(); next if ( $Conf{XferMethod} eq "archive" ); next if ( !$Privileged && !CheckPermission($host) ); @@ -51,8 +51,8 @@ sub action } # Age - my $lastBackup = ( $Backups[-1]{type} =~ m/^full|incr$/ ) ? -1 : -2; - $lastAge = sprintf("%.1f", (time - $Backups[$lastBackup]{startTime}) / (24 * 3600)); + 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 ) { @@ -62,7 +62,7 @@ sub action } # Color for errors - $lastXferErrors = $Backups[@Backups-1]{xferErrs} if ( @Backups ); + $lastXferErrors = $Backups[@Backups-1]->{xferErrs} if ( @Backups ); if ( $lastXferErrors == 0 ) { $lastXferErrorsColor = "MediumSeaGreen"; } else { @@ -88,18 +88,18 @@ sub action if ( scalar( @Backups ) ){ foreach my $backup ( @Backups ) { # Skip partial or active backups - next if ( $backup{type} !~ m/^full|incr$/ ); + 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 - $sizesadd_data($backup{sizeNew}) unless ( $backup{num} == 0 ); + $sizes->add_data($backup->{sizeNew}) unless ( $backup->{num} == 0 ); } # Ignore the last backup if it's not full or incr (which means it's either partial or active) - my $i = ( $Backups[-1]{type} =~ m/^full|incr$/ ) ? -1 : -2; - $new_size = $Backups[$i]{sizeNew}; - $new_size_avg = int $sizesmean; - $new_size_q1 = eval { int $sizesquantile(1) } || 0; - $new_size_q3 = eval { int $sizesquantile(3) } || 0; + my $i = ( $Backups[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2; + $new_size = $Backups[$i]->{sizeNew}; + $new_size_avg = int $sizes->mean; + $new_size_q1 = eval { int $sizes->quantile(1) } || 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