mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 08:04:36 +02:00
enhance node vm status hyperv
This commit is contained in:
parent
65349d54a8
commit
aa8d19e268
@ -39,10 +39,21 @@ Try {
|
|||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
$vms = Get-VM
|
$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) {
|
Foreach ($vm in $vms) {
|
||||||
$note = $vm.Notes -replace "\r",""
|
$note = $vm.Notes -replace "\r",""
|
||||||
$note = $note -replace "\n"," - "
|
$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 {
|
} Catch {
|
||||||
Write-Host $Error[0].Exception
|
Write-Host $Error[0].Exception
|
||||||
@ -63,4 +74,4 @@ __END__
|
|||||||
|
|
||||||
Method to get hyper-v informations.
|
Method to get hyper-v informations.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user