From 2d8e14d1751bcc6b76bc4167ef755f33df133ca3 Mon Sep 17 00:00:00 2001 From: Heuzef Date: Wed, 25 Sep 2019 10:18:32 +0200 Subject: [PATCH] Print results --- backuppc_check.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backuppc_check.pl b/backuppc_check.pl index 2ba9b15..f950932 100644 --- a/backuppc_check.pl +++ b/backuppc_check.pl @@ -9,7 +9,11 @@ use Getopt::Long; use Statistics::Descriptive; use Data::Dumper; -my $host = $ARGV[0]; +my $host = undef; + +GetOptions( + "host=s" => \$host +); # We need to switch to backuppc UID/GID my $uid = getuid(); @@ -35,7 +39,6 @@ if ( $host ) { new_size_median => 0, new_size_q1 => 0, new_size_q3 => 0, - duration => 0, comp_ratio => 0 }; @@ -64,7 +67,6 @@ if ( $host ) { $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} ) ) @@ -104,7 +106,6 @@ if ( $host ) { my $hostConf = $bpc->ConfigDataRead($host); my $conf = { %$mainConf, %$hostConf }; my $freq = ( $conf->{FullPeriod} > $conf->{IncrPeriod} ) ? $conf->{IncrPeriod} : $conf->{FullPeriod}; - my $duration = 0; my $bkp_num = 0; my $new_size_of_last_full = 0; @@ -143,12 +144,12 @@ if ( $host ) { } else { print<<"EOF"; -Usage: $0 --host= or --entity= +Usage: $0 --host= EOF } -# Print result +# Print results print("\n----------------\n"); print("new_size_median : $json->{new_size_median}"); print("\n");