Don't fail if Statistics::Descriptive doesn't support quantile

tags/zabbix-agent-addons-0.2.74-1
Daniel Berteaud 6 years ago
parent 8d9a64713c
commit a9e468b2e5
  1. 5
      zabbix_scripts/check_backuppc_sudo

@ -81,8 +81,9 @@ if ( $host ) {
$json->{new_size_avg} = int $sizes->mean; $json->{new_size_avg} = int $sizes->mean;
$json->{new_size_median} = int $sizes->median; $json->{new_size_median} = int $sizes->median;
$json->{new_size_q1} = int $sizes->quantile(1); # Some old versions of Statistics::Descriptive (eg, on el5) do not support quantile
$json->{new_size_q3} = int $sizes->quantile(3); $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->{enabled} = ( $conf->{BackupsDisable} > 0 ) ? 0 : 1;
$json->{total_size} = $sizes->sum + $json->{full_size} - 2 * $new_size_of_last_full; $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};

Loading…
Cancel
Save