Fix ready sizeNew from last backup (except when link hasn't ran yet)

tags/zabbix-agent-addons-0.2.105-1
Daniel Berteaud 5 years ago
parent 058aad1264
commit e080780248
  1. 4
      zabbix_scripts/check_backuppc_sudo

@ -90,10 +90,10 @@ if ( $host ) {
$json->{history_size} = $json->{total_size} - $json->{full_size}; $json->{history_size} = $json->{total_size} - $json->{full_size};
$json->{age} = time - $bpc_info[$i]->{startTime}; $json->{age} = time - $bpc_info[$i]->{startTime};
# For newSize, we need to wait for BackupPC_link to run, which can be delayed # For sizeNew, 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 # if a nightly process is running. In this case, use the stats from the previous backup
# Except when we ave a single backup, in which case we read stats of this only backup # Except when we ave a single backup, in which case we read stats of this only backup
$i = ( $backup->{sizeNew} || scalar @bpc_info == 1 ) ? -1 : -2; $i = ( $bpc_info[-1]->{sizeNew} || scalar @bpc_info == 1 ) ? -1 : -2;
$json->{new_size} = $bpc_info[$i]->{sizeNew}; $json->{new_size} = $bpc_info[$i]->{sizeNew};
$json->{comp_ratio} = ( $bpc_info[$i]->{sizeNew} > 0 ) ? $json->{comp_ratio} = ( $bpc_info[$i]->{sizeNew} > 0 ) ?
sprintf( "%.2f", 100 - ( $bpc_info[$i]->{sizeNewComp} * 100 / $bpc_info[$i]->{sizeNew} ) ) sprintf( "%.2f", 100 - ( $bpc_info[$i]->{sizeNewComp} * 100 / $bpc_info[$i]->{sizeNew} ) )

Loading…
Cancel
Save