Hello, I have setup vCheck on two hosts. I have amended few plugins already successfully but one is worrying me in the sense that I don´t know if I can rely on it. There are no VMs that need consolidation but the error it throws when I run it leaves me a doubt.
Both hosts have ISE connected to a vcenter.
On host 1, when I run vcheck.ps1 -config all ok. No errors. When I run plugin manually I get the error below (I sense it´s normal as it might need some parameters for $HostsViews contained in the vcheck script maybe?, but I´m not sure):
Exception calling "Add" with "2" argument(s): "Key cannot be null.
Parameter name: key"
At C:\VI-Tools\vCheck\vCheck-vSphere-master\Plugins\60 VM\45 VMs needing snapshot consolidation.ps1:13 char:31
On host2 when I run vcheck.ps1 -config I get the error below, and this worries me more (as this is the PROD vCheck box)
You cannot call a method on a null-valued expression.
At C:\vCheck-vSphere-master\Plugins\60 VM\45 VMs needing snapshot consolidation.ps1:14 char:25
I'm pasting the script for convenience as it´s not long, line 14 is the last one-liner:
$Title = "VMs needing snapshot consolidation"
$Header = "VMs needing snapshot consolidation [count]"
$Comments = "The following VMs have snapshots that failed to consolidate. See <a href='http://blogs.vmware.com/vsphere/2011/08/consolidate-snapshots.html' target='_blank'>this article</a> for more details"
$Display = "Table"
$Author = "Luc Dekens, Frederic Martin"
$PluginVersion = 1.3
$PluginCategory = "vSphere"
# Start of Settings
# End of Settings
$htabHostVersion = @{}
$HostsViews | Foreach-Object {$htabHostVersion.Add($_.MoRef,$_.config.product.version)}
$FullVM | Where-Object {$htabHostVersion[$_.runtime.host].Split('.')[0] -ge 5 -and $_.runtime.consolidationNeeded} | Sort-Object -Property Name | Select-Object Name,@{N="Consolidation needed";E={$_.Runtime.consolidationNeeded}}
The first error is due to an empty $HostViews, the content of which is created earlier in vCheck (plugin '00 Connection Plugin for vCenter.ps1').
And you can't do an Add to a hash table with a key that is $null.
The 2nd error is most probably due to the fact that $htabHostVersion[$_.runtime.host] returns $null, and you can't call the Split method on $null.
I suspect that $HostsViews does not contain all the ESXi nodes for which you have VMs in $FullVM.
Again $FullVM is calculated earlier in vCheck, namely in '00 Connection Plugin for vCenter.ps1'.
Are you sure you are getting correct results from plugin 00?
Can you run vCheck with just plugin 00 and 01, and check the summary report if all vCenter entities are reported correctly?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The first error is due to an empty $HostViews, the content of which is created earlier in vCheck (plugin '00 Connection Plugin for vCenter.ps1').
And you can't do an Add to a hash table with a key that is $null.
The 2nd error is most probably due to the fact that $htabHostVersion[$_.runtime.host] returns $null, and you can't call the Split method on $null.
I suspect that $HostsViews does not contain all the ESXi nodes for which you have VMs in $FullVM.
Again $FullVM is calculated earlier in vCheck, namely in '00 Connection Plugin for vCenter.ps1'.
Are you sure you are getting correct results from plugin 00?
Can you run vCheck with just plugin 00 and 01, and check the summary report if all vCenter entities are reported correctly?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
as usual thanks Luc!
We have few vcenter servers and for each of them I created a dedicated xml file that points to a customized globalvariable.ps1. I left the original globalvariable.ps1 untouched, but that is used everytime I run vcheck -config to refresh when adding new plugin. I looked into the plugin 00 and in fact I found all the variables involved in that and many other plugins. I will rather add our test vcenter server to the globalvariable.ps1 so that every time I run vcheck -config I will only get real errors. Have a good we!