If you’re an OnApp user you probably know you can make a VNC connection to your VM’s using the Control Panel. This uses a java applet in your browser as the VNC client.
Wouldn’t it be nice to use your own VNC client (like Remotix) instead?
In fact, you can, but OnApp spawns a VNC server on a (somewhat) random port and a new random VNC password for each sessions which you’ll have to figure out before setting up your connection.
According to the OnApp Helpdesk you can use these calls to get the required information:
As I’m lazy I didn’t want to do this manually every time, so I devised a little PHP script that can aid in finding the right information:
|
|
Usage
- Using the PHP CLI: Run
$ php OnAppInitiator.php
- The script will display all the information required and open up your default VNC client.
Caveats
- This script assumes that you have the PHP cURL extension installed and enabled.
- The script is currently HTTP only as it’s hard coded. With a little modification you can get HTTPS if your setup uses/requires that.
- You can get the VM’s unique ID in the OnApp CP. If you go to the VM’s detail page the URL for that page will look like
http://cloud.setup/virtual_machines/dfa2bcguwd9mbi
. The ID is evertyhing after the last/
. - The
open
call on the last line might not work on your OS; This script was developed/tested on Mac OSX. - In order to
open
aVNC://
link you’ll have to specify a link handler on the OS. I used RCDefaultApp on OSX to set Remotix as the default link handler for VNC links.
Future / TODO
The script is pretty crude in it’s current state but it gets the job done for my day to day needs.
I might fix a couple of things in the near future:
- Grabbing the required variables such as VMID from the run parameters
- Make the script ask for these required variables
- Fix the script for use with HTTPS
- Integrate this script with the OnApp CP so you can start your VNC client right from the CP