Print results

master
Heuzef 5 years ago
parent 0a154335a6
commit 2d8e14d175
  1. 13
      backuppc_check.pl

@ -9,7 +9,11 @@ use Getopt::Long;
use Statistics::Descriptive; use Statistics::Descriptive;
use Data::Dumper; use Data::Dumper;
my $host = $ARGV[0]; my $host = undef;
GetOptions(
"host=s" => \$host
);
# We need to switch to backuppc UID/GID # We need to switch to backuppc UID/GID
my $uid = getuid(); my $uid = getuid();
@ -35,7 +39,6 @@ if ( $host ) {
new_size_median => 0, new_size_median => 0,
new_size_q1 => 0, new_size_q1 => 0,
new_size_q3 => 0, new_size_q3 => 0,
duration => 0,
comp_ratio => 0 comp_ratio => 0
}; };
@ -64,7 +67,6 @@ if ( $host ) {
$json->{errors} = $bpc_info[$i]->{xferErrs}; $json->{errors} = $bpc_info[$i]->{xferErrs};
$json->{new_size} = $bpc_info[$i]->{sizeNew}; $json->{new_size} = $bpc_info[$i]->{sizeNew};
$json->{duration} = $bpc_info[$i]->{endTime} - $bpc_info[$i]->{startTime};
$json->{type} = $bpc_info[$i]->{type}; $json->{type} = $bpc_info[$i]->{type};
$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} ) )
@ -104,7 +106,6 @@ if ( $host ) {
my $hostConf = $bpc->ConfigDataRead($host); my $hostConf = $bpc->ConfigDataRead($host);
my $conf = { %$mainConf, %$hostConf }; my $conf = { %$mainConf, %$hostConf };
my $freq = ( $conf->{FullPeriod} > $conf->{IncrPeriod} ) ? $conf->{IncrPeriod} : $conf->{FullPeriod}; my $freq = ( $conf->{FullPeriod} > $conf->{IncrPeriod} ) ? $conf->{IncrPeriod} : $conf->{FullPeriod};
my $duration = 0;
my $bkp_num = 0; my $bkp_num = 0;
my $new_size_of_last_full = 0; my $new_size_of_last_full = 0;
@ -143,12 +144,12 @@ if ( $host ) {
} else { } else {
print<<"EOF"; print<<"EOF";
Usage: $0 --host=<host> or --entity=<entity> Usage: $0 --host=<host>
EOF EOF
} }
# Print result # Print results
print("\n----------------\n"); print("\n----------------\n");
print("new_size_median : $json->{new_size_median}"); print("new_size_median : $json->{new_size_median}");
print("\n"); print("\n");

Loading…
Cancel
Save