From 7b6b9688d4b0ae08216cee995c679c2cf487936a Mon Sep 17 00:00:00 2001 From: qgarnier Date: Mon, 27 Nov 2017 15:48:48 +0100 Subject: [PATCH] enhance node vm status hyperv --- .../common/powershell/hyperv/2012/nodevmstatus.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/centreon/common/powershell/hyperv/2012/nodevmstatus.pm b/centreon/common/powershell/hyperv/2012/nodevmstatus.pm index 23ac2ced5..478c46fa3 100644 --- a/centreon/common/powershell/hyperv/2012/nodevmstatus.pm +++ b/centreon/common/powershell/hyperv/2012/nodevmstatus.pm @@ -39,10 +39,21 @@ Try { $ErrorActionPreference = "Stop" $vms = Get-VM + $node_is_clustered = 0 + Try { + If (@(Get-ClusterNode -ea Ignore).Count -ne 0) { + $node_is_clustered = 1 + } + } Catch { + } Foreach ($vm in $vms) { $note = $vm.Notes -replace "\r","" $note = $note -replace "\n"," - " - Write-Host "[name=" $vm.VMName "][state=" $vm.State "][status=" $vm.Status "][IsClustered=" $vm.IsClustered "][note=" $note "]" + $isClustered = $vm.IsClustered + if ($node_is_clustered == 0) { + $isClustered = "nodeNotClustered" + } + Write-Host "[name=" $vm.VMName "][state=" $vm.State "][status=" $vm.Status "][IsClustered=" $isClustered "][note=" $note "]" } } Catch { Write-Host $Error[0].Exception @@ -63,4 +74,4 @@ __END__ Method to get hyper-v informations. -=cut \ No newline at end of file +=cut