From 89b874e97c92a019a6dfe634fdc63186fc9fa3e0 Mon Sep 17 00:00:00 2001 From: Heuzef Date: Wed, 25 Sep 2019 11:41:27 +0200 Subject: [PATCH] Clean json entry --- backuppc_check.pl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/backuppc_check.pl b/backuppc_check.pl index 0c3d0e1..19ba24a 100644 --- a/backuppc_check.pl +++ b/backuppc_check.pl @@ -32,14 +32,12 @@ if ( $host ) { my $age = -1; $json = { bkp => 0, - full_size => 0, errors => 0, new_size => 0, new_size_avg => 0, new_size_median => 0, new_size_q1 => 0, - new_size_q3 => 0, - comp_ratio => 0 + new_size_q3 => 0 }; my $lastXferErrors = 0; @@ -72,10 +70,8 @@ if ( $host ) { # Some old versions of Statistics::Descriptive (eg, on el5) do not support quantile $json->{new_size_q1} = eval { int $sizes->quantile(1) } || 0; $json->{new_size_q3} = eval { int $sizes->quantile(3) } || 0; - $json->{enabled} = ( $conf->{BackupsDisable} > 0 ) ? 0 : 1; - $json->{total_size} = $sizes->sum + $json->{full_size} - 2 * $new_size_of_last_full; $json->{age} = time - $bpc_info[$i]->{startTime}; - $lastAge = sprintf("%.1f", ($json->{age}) / 84600); + $json->{lastAge} = sprintf("%.1f", ($json->{age}) / 84600); $json->{max_errors} = $conf->{MaxXferError} || 0; } } @@ -90,7 +86,7 @@ EOF # Print results print("\n----------------\n"); -print("Last Backup : $lastAge"); +print("Last Backup : $json->{$lastAge}"); print("\n"); print("Errors : $json->{errors}"); print("\n");