Clean json entry

master
Heuzef 5 years ago
parent 3b01d346c6
commit 89b874e97c
  1. 10
      backuppc_check.pl

@ -32,14 +32,12 @@ if ( $host ) {
my $age = -1; my $age = -1;
$json = { $json = {
bkp => 0, bkp => 0,
full_size => 0,
errors => 0, errors => 0,
new_size => 0, new_size => 0,
new_size_avg => 0, new_size_avg => 0,
new_size_median => 0, new_size_median => 0,
new_size_q1 => 0, new_size_q1 => 0,
new_size_q3 => 0, new_size_q3 => 0
comp_ratio => 0
}; };
my $lastXferErrors = 0; my $lastXferErrors = 0;
@ -72,10 +70,8 @@ if ( $host ) {
# Some old versions of Statistics::Descriptive (eg, on el5) do not support quantile # 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_q1} = eval { int $sizes->quantile(1) } || 0;
$json->{new_size_q3} = eval { int $sizes->quantile(3) } || 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}; $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; $json->{max_errors} = $conf->{MaxXferError} || 0;
} }
} }
@ -90,7 +86,7 @@ EOF
# Print results # Print results
print("\n----------------\n"); print("\n----------------\n");
print("Last Backup : $lastAge"); print("Last Backup : $json->{$lastAge}");
print("\n"); print("\n");
print("Errors : $json->{errors}"); print("Errors : $json->{errors}");
print("\n"); print("\n");

Loading…
Cancel
Save