Open audiocoach opened 10 months ago
Hi, I noticed there was already an issue (#66) with the same errors which was closed because of no further feedback from the op. It seems to be related to storage pools, in my case normal standard pools, in #66 S2D (Storage Spaces direct) pools.
I think I have found a way to suppress the powershell errors and the warning about the cluster shared volume. I don't know if it is a good way because I am not very experienced with powershell but for me it seems to work
C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-hyperv\provider\vcomputer\Get-IcingaVirtualComputerInfo.psm1 Add try and catch in the follwing section
foreach ($disk in $VComputerHardDisks.Keys) {
try{
$PhysicalDisk = $VComputerHardDisks[$disk];
if ($PhysicalDisk.DriveReference.ContainsKey($SnapshotPart) -eq $FALSE) {
continue;
}
[string]$DiskId = $PhysicalDisk.DriveReference[$SnapshotPart];
$FreeSpace = $PhysicalDisk.PartitionLayout[$DiskId].FreeSpace;
$PartSize = $PhysicalDisk.PartitionLayout[$DiskId].Size;
if ($details.Snapshots.Info[$SnapshotPart].ContainsKey('FreeSpace') -eq $FALSE) {
$details.Snapshots.Info[$SnapshotPart].Add('FreeSpace', $FreeSpace);
}
if ($details.Snapshots.Info[$SnapshotPart].ContainsKey('Size') -eq $FALSE) {
$details.Snapshots.Info[$SnapshotPart].Add('Size', $PartSize);
}
break;
}
catch {
continue
}
}
and also in the following section
try{
if ($PhysicalDisk.DriveReference.ContainsKey($details.Partition) -eq $FALSE) {
continue;
}
}
catch {
continue
}
[string]$PartitionId = $PhysicalDisk.DriveReference[$details.Partition];
# Gather informations about the virtual computers hard disk drive
$PartitionSize = $PhysicalDisk.PartitionLayout[$PartitionId].Size;
For the wrong warning regarding the cluster shared volume do the following: C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-hyperv\plugins\Invoke-IcingaCheckHyperVSnapshot.psm1 Comment line 307 - 314
# if ($VirtualComputers.Summary.ContainsKey('SnapshotLocated')) {
# $CheckPackage.AddCheck(
# (
# New-IcingaCheck `
# -Name 'Snapshot images seem to be located on a Cluster Shared Volume but Cluster-Plugins are not installed' -NoPerfData
# ).SetWarning()
# );
# }
After the manual changes you have to rebuild the cache and restart the icinga services:
icinga -rebuildcache
Restart-IcingaService icinga2
Restart-IcingaService icingapowershell
Fixed with changes according to https://github.com/Icinga/icinga-powershell-plugins/issues/390
Hello,
I get powershell errors and an unknown state when running the Invoke-IcingaCheckHyperVVMHealth, Invoke-IcingaCheckHyperVOverCommitment and Invoke-IcingaCheckHyperVSnapshot against an hyper-v host with normal windows storage pools using storage spaces (not storage spaces direct!!!).
The problem seems to be in the following region:
For example my output for Invoke-IcingaCheckHyperVOverCommitment -Verbosity 2 looks like this. The errors for Invoke-IcingaCheckHyperVSnapshot and Invoke-IcingaCheckHyperVVMHealth look similar.
Moreover the Warning "VM images seem to be located on a Cluster Shared Volume but Cluster-Plugins are not installed" is wrong. The storage pool is no cluster shared volume, just a standard storage spaces pool on a standalone hyper-v host with internal nvme ssds.
As a quick, temporary workaround would it be possible to suppress the powershell errors and if so how can I achieve this? I am asking because as you can see I get a valid output at the end (for all three checks) but due to the powershell errors it's returning an unknown state in icingaweb2
Icinga 2.14.1 Icinga Web 2.12.1 Icinga Director 1.11 Icinga for Windows 1.11.1 Hyper-V Plugins: 1.3.0