We just picked up a new development server that I've loaded ESXi on.
The room it's in is well ventilated during the day but at night the door is closed and it gets quite toasty in there. I've been asked to have the box shut down nightly, as we won't be using it anyways when we're not in the office.
Is there a way to do this?
I'd personally let the server run or move it to a better running environment. This may not be worth automating.
If you must shut down the entire host, please make sure that your VMs have the VMWare tools installed (to allow graceful shutdown and power up) and that they're set to stop and start with the host.
You can use the vCli and schedule a cron job to place the host in maintenance mode and/or shut down the host entirely. I would probably just manually run the host shutdown command from the GUI client at the end of the day, though.
Before auto shutdown you should look at the host power settings and adjust them acordingly. See https://www.vmware.com/files/pdf/techpaper/hpm-performance-vsphere55-white-paper.pdf powercycling (and also thermalcycling from what you say) will reduce the lifespan of the server
vCli has already been mentioned and it is a best way to go in my opion.
However it seems you are dealing with a bigger problem , i.e overheating server room.This needs to be dealt with on a correct level.Fix HVAC asap or you will damage your equipment eventually.Read on http://www.openxtra.co.uk/articles/skimp-server-room-ac
You can power it on by LAN. If you have such option in ESXi's BIOS (Usually Wake On LAN option). So you can add schedule in another machine to wake up your ESXi. And do not forget configure auto start your VMs when ESXi starting. Some times BIOSes have schedule option for power on machine.
You can use VMware Distributed Power Management (DPM) for power saving.
You can enable ssh server on ESXi and copy your ssh key to the server, read the following on how to do that: Monitor LSI 3ware raid controller on ESXi
Then to shutdown the virtual machines and power off the ESXi server I would schedule a cronjob on a remote physical server:
In this case shutdown the virtual machines at Dec. 22, 9:20 AM and power down the ESXi server at Dec. 22, 9:30 AM.
The /sbin/shutdown.sh file is a script that cleanly shuts down the virtual machines and it comes with the ESXi instance. The poweroff command is just "busybox poweroff".
If you have python running you can use the script I wrote below to wake up and shutdown your ESXi server. I have a Dell R810 at home that I use as my Cisco VIRL Server and other things but i only power it up when I need it. It is downstairs so i wanted a way that i could start it and stop it from upstairs. I have enabled Wake On Lan on the primary NIC on the server (CTRL-S as it is booting and enable for your primary NIC). In vSphere set your VMs to start and stop with the server as this script will shutdown your VMs and power off the server. Enable ssh for your ESXi server, enter the MAC of the primary NIC, and change the root password, server ip, and path to python below.
python esxi.py -w Will Wake the server by sending the WOL magic packet. python esxi.py -s will shutdown your VMs and power-off your server.
Dependencies
paramiko wakeonlan argparse
If this works for you, or if you have a way to improve it, please let me know!
Mike Partain