The article Save Money using Citrix Octoblu Automation for Power Management from Dave Brett got me to finally start playing with Octoblu.
We chatted back and forth to improve the PowerShell scripts used, and at the end got some expert help from PowerShell Guru Tore Groneng which lead to his article Giving a helping hand – Community Power.
Now the Octoblu Workflow worked perfectly for my Mac Mini Citrix XenServer Pool. But let’s face it, shutting down a couple of VM’s won’t even save me $1 a month because the XenServers still needs to be running. Same applies for Intel NUC’s and other popular homelab hardware without IPMI.
I’m fortunate enough to own two SuperMicro SYS-5028D-TN4T with IPMI. The Power Consumption with VMware ESXi is 40 watt idle, 90 watt with heavy load and 10 watt with IPMI only. So if I could shutdown my lab for 12 hours each day I would save 57 kWH per month.
This won’t save me much money, but it’s very flexible because I can now start my lab from anywhere in the world on demand if there was any power outtake.
Start SuperMicro Lab
For this I’m using the native PowerShell cmdlet Get–PcsvDevice that was introduced in Windows 2008 R2. The first code block convert username and password into $cred which is used later for the credentials.
1 2 3 4 5 6 7 8 9 10 |
$username = "ADMIN" $password = "ADMIN" $secstr = New-Object -TypeName System.Security.SecureString $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)} $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr $IP1 = "192.168.2.104" $IP2 = "192.168.2.106" Get-PcsvDevice -TargetAddress $IP1 -ManagementProtocol IPMI -Credential $Cred | Start-PcsvDevice Get-PcsvDevice -TargetAddress $IP2 -ManagementProtocol IPMI -Credential $Cred | Start-PcsvDevice |
The startup order and delay is defined on each ESXi host.
Stop SuperMicro Lab
For this I’m using VMware PowerCli to get a controlled shutdown of my VM’s.
1 2 3 4 5 6 7 |
Add-PsSnapin VMware.VimAutomation.Core -ea "SilentlyContinue" Connect-VIServer vcsa.vsphere.local -user vsphere.local\administrator -password PASSWORD $vmservers | select Name | export-csv C:\Scripts\VMWSRV.csv -NoTypeInformation $vmservers | Shutdown-VMGuest -Confirm:$false stop-vmhost -VMhost esxi-ss-02.vsphere.local -Confirm:$false -Force stop-vmhost -VMhost esxi-ss-01.vsphere.local -Confirm:$false -Force |
Good article – Just Fyi. You may know that XenServer WLB already has this power on/off XenServer host ability years ago based on the host load.
Thanks Zheng, but WLB is not available for free XenServer riders.