diff --git a/apps/hyperv/2012/local/mode/nodesnapshot.pm b/apps/hyperv/2012/local/mode/nodesnapshot.pm index c1e37834e..0e8bfab17 100644 --- a/apps/hyperv/2012/local/mode/nodesnapshot.pm +++ b/apps/hyperv/2012/local/mode/nodesnapshot.pm @@ -151,6 +151,7 @@ sub manage_selection { my $checkpoint = { backing => -1, snapshot => -1 }; my $checkpoints = (ref($node->{checkpoints}) eq 'ARRAY') ? $node->{checkpoints} : [ $node->{checkpoints} ]; foreach my $chkpt (@$checkpoints) { + next if (!defined($chkpt)); $chkpt->{creation_time} =~ s/,/\./g; $checkpoint->{ $chkpt->{type} } = $chkpt->{creation_time} if ($chkpt->{creation_time} > 0 && ($checkpoint->{ $chkpt->{type} } == -1 || $checkpoint->{ $chkpt->{type} } > $chkpt->{creation_time})); } @@ -158,20 +159,20 @@ sub manage_selection { if (defined($self->{option_results}->{filter_vm}) && $self->{option_results}->{filter_vm} ne '' && $node->{name} !~ /$self->{option_results}->{filter_vm}/i) { - $self->{output}->output_add(long_msg => "skipping '" . $node->{name} . "': no matching filter.", debug => 1); + $self->{output}->output_add(long_msg => "skipping '" . $node->{name} . "': no matching filter.", debug => 1); next; } - if (defined($self->{option_results}->{filter_note}) && $self->{option_results}->{filter_note} ne '' && + if (defined($self->{option_results}->{filter_note}) && $self->{option_results}->{filter_note} ne '' && defined($node->{note}) && $node->{note} !~ /$self->{option_results}->{filter_note}/i) { - $self->{output}->output_add(long_msg => "skipping '" . $node->{name} . "': no matching filter.", debug => 1); + $self->{output}->output_add(long_msg => "skipping '" . $node->{name} . "': no matching filter.", debug => 1); next; } if (defined($self->{option_results}->{filter_status}) && $self->{option_results}->{filter_status} ne '' && $node_vm_state->{ $node->{state} } !~ /$self->{option_results}->{filter_status}/i) { - $self->{output}->output_add(long_msg => "skipping '" . $node->{name} . "': no matching filter.", debug => 1); + $self->{output}->output_add(long_msg => "skipping '" . $node->{name} . "': no matching filter.", debug => 1); next; } - + $self->{vm}->{$id} = { display => $node->{name}, snapshot => $checkpoint->{snapshot} > 0 ? $time - $checkpoint->{snapshot} : undef, diff --git a/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm b/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm index f4425c328..cf4e30743 100644 --- a/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm +++ b/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm @@ -53,18 +53,18 @@ Try { $item.name = $vm.VMName $item.state = $vm.State.value__ $item.integration_services_state = $vm.IntegrationServicesState - $item.integration_services_version = $vm.IntegrationServicesVersion + $item.integration_services_version = $vm.IntegrationServicesVersion.toString() $item.note = $note - - $services = New-Object System.Collections.Generic.List[Hashtable]; - Foreach ($service in $VM.VMIntegrationService) { - $service = @{} - $service.name = $service.Name - $service.enabled = $service.Enabled - $service.primary_operational_status = $service.PrimaryOperationalStatus.value__ - $service.secondary_operational_status = $service.SecondaryOperationalStatus.value__ - $services.Add($service) + $services = New-Object System.Collections.Generic.List[Hashtable]; + Foreach ($service in $vm.VMIntegrationService) { + $item_service = @{} + + $item_service.service = $service.Name + $item_service.enabled = $service.Enabled + $item_service.primary_operational_status = $service.PrimaryOperationalStatus.value__ + $item_service.secondary_operational_status = $service.SecondaryOperationalStatus.value__ + $services.Add($item_service) } $item.services = $services