Dear all,
Could anyone help me to write a script for :
Thank you for your kindly help
Best regards
Could you be more specific on what you want to check as status ?
Is that the powerstate, any alarms,.... ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD
I want to check these things
-ESXI host :
+ ssh/telnet to the host
+ power status of the host
- VMs inside host
+ remote desktop connection the GuestOS on VM ( Windows)
+ power state of VMs
+ status of GuestOS ( hang/not responding or normal)
- send a cumulative email of all failures in one check
-script run every x minutes, we can configure this time
Thank you very much fot your help
That is quite a bit of code you want :smileygrin:
Let's take this step by step.
1) The ESXi powerstate
Quite simple, use the Get-VMHost cmdlet and check the PowerState property
Get-VMHost | Select Name,PowerState
2) The SSH service
Again reasonably simple
Get-VMHost | Get-VMHostService | where {$_.Key -eq 'TSM-SSH'} |
Select @{N='VMHost';E={$_.VMHost.Name}},Running
3) RDP on VM
One way of checking this is to verify if the Windows Firewall has the incoming RDP rule enabled.
netsh advfirewall firewall show rule name="Remote Desktop (TCP-In)"
This can be tested with the Invoke-VMScript cmdlet, but that requires VMware Tools to be installed.
Is that the case ?
Can you do an Invoke-VMScript against all the VMs that run a Windows guest OS ?
4) VM powerstate
A simple one
Get-VM | Select Name,PowerState
5) Guest OS
Not sure how you want to test this.
Would a ping be sufficient ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD so much,
3) RDP on VM
All VMs had vmware tools installed
sorry that I don't have any idea about Invoke-VMScript
Could you please help to write a code that use Invoke-VMScript?
5) GuestOS
I think a ping test would be fine for this
Thank you very much for your help
Hi LucD,
I got the function send email already, but I am still confused about the structure of script?
The condition, if...else
- Check the ESX host is alive or not ( could we use ping?)
+ If ok, check whether we can SSH to it
+ If not, send email report
Next, if ESX host is ok
+ Check VMs power state
+ Check RDP to VMs
+ If not, send email report
Thank you for your very kindly help
Regards
Hi LucD,
Could you help me with this?
Thank you very much