Header
 
If you only want to see the news of certain categories, please click on the desired categories below:
ALL Android Hardware Internet Linux Nagios/Monitoring Personal PHP Proxy Shell VMware Windows Wyse

VMware: Schedule automatic reboot or shutdown of physical ESX(i) server
Today, the first time for a long while, I am again in the need to make a scheduled shutdown of a physical ESXi server. Strangely it seems that this function disappeared out of the vSphere Client. I'm pretty sure, it worked with one of the first VirtualCenter versions. But after a bit of research I found some hints about the vSphere CLI SDK. After a bit of testing I figured out how it works and it works just great. Now I'm able to schedule a cronjob, launching the reboot or shutdown command fully automated. To be able to shutdown or reboot, you have to enter maintenance mode. The command looks like this:

/usr/lib/vmware-vcli/apps/host/hostops.pl --server VCENTER_SERVER --target_host NAME_OF_ESX_HOST --operation enter_maintenance --username VCENTER_USER --password VCENTER_PASSWORD

Note, that for the --target_host you mustn't use the IP-address of the ESX/i server but the name used in the VirtualCenter configuration (as you see it in your vSphere Client). Now we make the same for the shutdown command:

/usr/lib/vmware-vcli/apps/host/hostops.pl --server VCENTER_SERVER --target_host NAME_OF_ESX_HOST --operation shutdown --username VCENTER_USER --password VCENTER_PASSWORD

Commandline baby!
 
Friday - Feb 12th 2010 - 12.34 pm (+0100) - Switzerland - (0 comments)

 

Add a comment

Show form to leave a comment

Comments (newest first):

No comments yet.

Go to Homepage home RSS Feed
About ck about
Linux Howtos how to's
Nagios Plugins nagios plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

9480 Days
until Death of Computers
Why?