I got the idea for this post a few months back after noticing several questions on the VMTN forums on how to enable webAccess for ESXi. With ESXi, the webAccess interface is no longer available as it was with classic ESX. After seeing the question and randomly browsing through the various flings on VMware Labs, I noticed an interesting fling called Ops Panel for ESX. Ops Panel provides a simple javascript that leverages the vSphere MOB to perform basic power operations for virtual machines and it is loaded onto the homepage of a classic ESX host remotely using Greasemonkey.

I immediately wondered if I could run the javascript directly on an ESX or ESXi host without the use of Greasemonkey. With a quick tweak of the default index.html homepage, I was able to get a simple “ghetto” webAccess running on both an ESX and ESXi host. I also ran into several bugs, one that dealt with how the power state of a virtual machines was being captured by the differences in the ESX(i) 4.0, 4.1 and 5.0 APIs and a recent fix to a CSRF (Cross-Site Request Forgery) vulnerability in ESX(i) 4.1 Update 1 that made it difficult to get Ops Panel running on more than just ESX(i) 4.0.

I reached out to the fling creator Ivan Donchev and he was kind enough to help assist me in the issues I ran into and also provided an updated version of his script to properly handle both the power state and the CSRF workaround. He recently published an update to his script a few weeks back supporting both ESX 4 and ESXi 5 but missed ESX(i) 4.1 support due to limited amount of testing. This was an easy fix and I modified the script to include support for ESX(i) 4.1 and also changed the default power off operation to a guestOS shutdown. The modified version of the script can be downloaded here.

When you browse to the homepage of your ESX(i) host using the browser, you will be prompted to login which require the same credentials as if you were to login to the host directly using the vSphere Client or vSphere MOB.

Once you have logged in, it will search for all virtual machines running on the host and generate the list of virtual machines and their respective power states.

You can then perform the appropriate power operation such as a power on, shutdown or suspend using the icons on the right. This can be really useful if you don’t have access to vCenter Server, vSphere Client or SSH access to the host but just have a web browser.

To load the Ops Panel script on an ESX(i) host, you will need to do the following:

Note: These instructions are applicable for both ESX and ESXi, but with ESXi, it is important that the commands to copy both the modified index.html and Ops Panel script to docroot are executed as changes are not persisted after a reboot for ESXi hosts.

You can also add this to your kickstart file by appending the lines above in your %firstboot stanza so you automatically get Ops Panel after install. Though this will not give you a full webAccess that classic ESX did but it definitely is a useful way to quickly get to your virtual machines and perform simple power operations using a web browser.

13 thoughts on “Ghetto webAccess for ESXi

  1. Hello,
    very interesting idea, and would be useful if it is working.
    I followed your instructions on a fresh install of ESXi 5.0, but there were some error, and after correcting them it is not working at the end.

    1. can’t download ops.js from the given address

    I used this one: http://download.virtuallyghetto.com/ops.js

    2. the sed command don’t work, finally i edited the index.html manually.

    Now when i check the ESXi homepage, look at the source, the modifications are there, i can get the ops.js with the url, but there is no visible change on the page.

    Tried with IE, FF and Chrome, no errors, but nothing happens.

    I hope can help,

  2. @Zoli,

    The “air.primp-industries” is the kickstart host in my lab. To download the script, you need to use http://download.virtuallyghetto.com/ops.js

    Regarding the sed, make sure you’re properly escaping the slashes. If it was loaded succesfully, it will prompt you for a login. If not, then there maybe a typo index.html and ensure ops.js is reachable.

  3. Yep, finally it is now working. (Found the typo, I left an unwanted escaping backslash in the html code.)

    Again, simple, but excellent solution,

    Thanks William!

  4. Hi, after the command:
    # update rc.local to automatically restore changes
    echo “cp -f /vmfs/volumes/datastore1/ops.js /usr/lib/vmware/hostd/docroot/ops.js” >> /etc/rc.local
    echo “cp -f /vmfs/volumes/datastore1/index.html /usr/lib/vmware/hostd/docroot/index.html” >> /etc/rc.local
    i have a meesage: “can’t create /etc/rc.local: Operation not permitted”
    What does it mean!?

    • Is this for ESXi 5.1? If so, editing /etc/rc.local is no longer valid and you need to use /etc/rc.local/local.sh instead for any custom init boot commands

    • I’ve tried it on 5.1 without any success, installation went fine, but it keeps stating: “Loading….” did anything chance on 5.1 that prevents it from working ?

      Used to work fine on another host with 4.1 and 5.

Thanks for the comment!