From 3b01d346c6613307778aa02d06f2510763979e8a Mon Sep 17 00:00:00 2001 From: Heuzef Date: Wed, 25 Sep 2019 11:36:26 +0200 Subject: [PATCH] Remove entity --- backuppc_check.pl | 48 +----------------------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/backuppc_check.pl b/backuppc_check.pl index 3b6591a..0c3d0e1 100644 --- a/backuppc_check.pl +++ b/backuppc_check.pl @@ -80,53 +80,7 @@ if ( $host ) { } } - my $total_new = 0; - my $total_comp = 0; - - foreach my $host ( keys %{ $bpc->HostInfoRead } ) { - next unless $host =~ m/^(vm_)?\Q$entity\E_.*/; - my $full_size; - - $json->{hosts}++; - - my $hostConf = $bpc->ConfigDataRead($host); - my $conf = { %$mainConf, %$hostConf }; - my $freq = ( $conf->{FullPeriod} > $conf->{IncrPeriod} ) ? $conf->{IncrPeriod} : $conf->{FullPeriod}; - my $bkp_num = 0; - my $new_size_of_last_full = 0; - - foreach my $backup ( $bpc->BackupInfoRead( $host ) ) { - next if ( $backup->{type} !~ m/^full|incr$/ ); - - # Save the total size of the last full backup - if ( $backup->{type} eq 'full' ) { - $full_size = $backup->{size}; - $new_size_of_last_full = $backup->{sizeNew}; - } - - $json->{size} += $backup->{sizeNew}; - $total_new += $backup->{sizeNew}; - $total_comp += $backup->{sizeNewComp}; - $bkp_num++; - $json->{bkp}++; - } - # Compute the average cost as the number of hours per day spent - # to backup this host - $json->{perf} += ( $bkp_num > 0 ) ? $duration / ( 3600 * $bkp_num * $freq ) : 0; - - # $json->{size} represent the total size used by this host. - # But we want to substract the new size of the last full, as for this one we - # do not count sizeNew but size. As we've already added sizeNew we need to substract it 2 times - $json->{size} += $full_size - 2 * $new_size_of_last_full; - } - $json->{ratio} = ( $total_new > 0 ) ? 100 - ( $total_comp * 100 / $total_new ) : 0; - - # Round some values - foreach my $key ( qw(ratio perf) ) { - $json->{$key} = sprintf( "%.2f", $json->{$key} ); - } - -} else { +else { print<<"EOF"; Usage: $0 --host=