|
|
|
@ -64,7 +64,7 @@ if ( $host ) { |
|
|
|
|
# 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 |
|
|
|
|
# Also exclude if size is not defined. This can happen in BackupPC v3 when |
|
|
|
|
# the link process is waiting for the nightly to finish |
|
|
|
|
# the BackupPC_link process is waiting for the nightly to finish |
|
|
|
|
$sizes->add_data($backup->{sizeNew}) unless ( $backup->{num} == 0 || !$backup->{sizeNew} ); |
|
|
|
|
$json->{bkp}++; |
|
|
|
|
} |
|
|
|
@ -73,13 +73,8 @@ if ( $host ) { |
|
|
|
|
my $i = ( $bpc_info[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2; |
|
|
|
|
|
|
|
|
|
$json->{errors} = $bpc_info[$i]->{xferErrs}; |
|
|
|
|
$json->{new_size} = $bpc_info[$i]->{sizeNew}; |
|
|
|
|
$json->{duration} = $bpc_info[$i]->{endTime} - $bpc_info[$i]->{startTime}; |
|
|
|
|
$json->{type} = $bpc_info[$i]->{type}; |
|
|
|
|
$json->{comp_ratio} = ( $bpc_info[$i]->{sizeNew} > 0 ) ? |
|
|
|
|
sprintf( "%.2f", 100 - ( $bpc_info[$i]->{sizeNewComp} * 100 / $bpc_info[$i]->{sizeNew} ) ) |
|
|
|
|
: |
|
|
|
|
0; |
|
|
|
|
|
|
|
|
|
$json->{new_size_avg} = int $sizes->mean; |
|
|
|
|
$json->{new_size_median} = int $sizes->median; |
|
|
|
@ -90,6 +85,15 @@ if ( $host ) { |
|
|
|
|
$json->{total_size} = $sizes->sum + $json->{full_size} - 2 * $new_size_of_last_full; |
|
|
|
|
$json->{age} = time - $bpc_info[$i]->{startTime}; |
|
|
|
|
|
|
|
|
|
# For newSize, we need to wait for BackupPC_link to run, which can be delayed |
|
|
|
|
# if a nightly process is running. In this case, use the stats from the previous backup |
|
|
|
|
$i = ( $backup->{sizeNew} ) ? -1 : -2; |
|
|
|
|
$json->{new_size} = $bpc_info[$i]->{sizeNew}; |
|
|
|
|
$json->{comp_ratio} = ( $bpc_info[$i]->{sizeNew} > 0 ) ? |
|
|
|
|
sprintf( "%.2f", 100 - ( $bpc_info[$i]->{sizeNewComp} * 100 / $bpc_info[$i]->{sizeNew} ) ) |
|
|
|
|
: |
|
|
|
|
0; |
|
|
|
|
|
|
|
|
|
$json->{max_errors} = $conf->{MaxXferError} || 0; |
|
|
|
|
} |
|
|
|
|
} elsif ( $entity ) { |
|
|
|
|