Fix pve script when no net or disk stats are available

tags/zabbix-agent-addons-0.2.86-1
Daniel Berteaud 5 years ago
parent 36c0a38922
commit 28d794aba6
  1. 8
      zabbix_scripts/check_pve_sudo

@ -67,10 +67,10 @@ if ($cluster){
my $guests = from_json(qx($pvesh get /cluster/resources --type=vm $pvesh_opt 2>/dev/null));
foreach my $guest (@{$guests}){
$json->{network}->{in} += $guest->{netin};
$json->{network}->{out} += $guest->{netout};
$json->{disk}->{read} += $guest->{diskread};
$json->{disk}->{write} += $guest->{diskwrite};
$json->{network}->{in} += $guest->{netin} || 0;
$json->{network}->{out} += $guest->{netout} || 0;
$json->{disk}->{read} += $guest->{diskread} || 0;
$json->{disk}->{write} += $guest->{diskwrite} || 0;
}
} elsif ($node){
foreach my $item (qw(status version subscription)){

Loading…
Cancel
Save