WHMCS Module V2

From Virtualizor Wiki
(Redirected from WHMCS Module)
Jump to: navigation, search

Overview


Softaculous Virtualizor supports the remote creation of Virtual Machines / VPS. WHMCS can be configured to create the VPS as soon as you accept the Order (Automatically or Manually). We provide a module for WHMCS to enable you to do so. Setting it up is really easy. You can create, delete, suspend a VPS with this module.

The endusers can also manage their VPS through the WHMCS interface without actually logging into Virtualizor.
Note : This module (version 2) requires Virtualizor 2.8.0+ on the master.
Note : The existing plans created on "WHMCS Module 1" will be backward compatible.

If you are looking for the WHMCS Module V1 then you can find it here.

Download


Download the Virtualizor WHMCS module from HERE. (Last updated : May 4, 2016)
Unzip it and upload the folder virtualizor (the folder itself), in your /path/to/whmcs/modules/servers/ Directory.
Please make sure that the upload was done properly and the following folder exists :
/path/to/whmcs/modules/servers/virtualizor

Ports

Virtualizor uses ports from 4081 - 4085. If there is any firewall restricting this, you will need to allow these ports.


Features


Feature Screenshot
VPS Information View in WHMCS Client Panel Whmcs-client-panel.png
VPS information View in WHMCS Admin Panel Whmcs-admin.jpg

Servers Key


Virtualizor generates a Unique Key and Key Pass when its installed on the server. You will need the servers Key and Key Pass to add the server to WHMCS. This information can be found from the Virtualizor Admin Panel -> Configuration -> Server Info

WHMCS serverinfo1.jpg

Adding Server to WHMCS


Note : Only Master server needs to be added on WHMCS.
To add the Virtualizor Server to WHMCS login to WHMCS Admin Panel Then go to WHMCS Admin Panel -> Setup -> Servers -> Add New Server Fill the form as shown in the below images :

WHMCS Add Server1.gif


WHMCS Add Server2.gif


WHMCS Add Server3.gif

Creating a Product

Now, you will need to create a product.

Product


To do so go to WHMCS Admin Panel -> Setup -> Products/Services -> Create a New Product Fill in the details as per the following image and specify the Products Name of your choice

WHMCS Create Product.gif

Module Settings


The WHMCS module has been updated to a new and simple version. It includes selecting the module name and setting up the fields as shown in the image below:

Whmcs-module.jpg

The Fields are:

  • Virtualizor Server : Select the type of virtualizor server where you want to create your VPS.
  • Type : Select the type of Virtualization being used.
  • Select Plan : Select plan which you have created on virtualizor panel.
  • Default Node/Group: Select the Server or node Group or any individual server. (NOTE : [G] denotes the group)

Here you have to select the Virtualizor server and then type of virtualization. After selecting these you have to first save the changes and after that you can select Virtualizor Plan (as created on your Virtualizor Master) and Default Node/Group.

If you havent created a Virtualizor Plan you will need to do so as following :

Virt-add-plan.png


If you want to know more about adding a Plan click on this link Add a Plan

Custom Fields


Now Click on the Custom Fields Tab and fill in the form as per the following image

Configoptions.png

Just for your information the vpsid is the VPS ID as per the Virtualizor Database and needs to be stored for any future action like Terminate, Suspend, etc. Please fill it as per the above Image.

The OS field is the List of Operating System Templates on your server. Virtualizor provides templates to its users. Its a COMMA seperated value. This will allow the USER to choose the OS when he is signing up for the VPS. Also the list should be the names as listed in the Virtualizor Admin Panel -> Media -> OS Templates. Again, use the Name and not Filename as seen in the Virtualizor Admin.

The ISO field is to display list of ISO images to your clients. This field will allow users to choose the ISO image while signing up for any plan.

The node_ram_select field is an optional field. This field is useful when you want to choose servers (where your VPSs are going to be created) based on FREE RAM among your servers.

NOTE : Please add 'none' value when you add ISO and OS field. (Please refer the screenshot above)

NOTE : ISO option is not supported for OpenVZ and XEN-PV VPS.

Configurable Options [OPTIONAL]


You can add the Configurable Options as per your requirements or exclude one or more of the options below if you do not need it.

NOTE : The order of preference for selection of Configurable Options is first i.e. If a Product/Service has (lets say) Ram defined as 512 MB and you have also created a Configurable Option with variable Ram options, then the users chosen Ram value from configurable options will be used and not the ram value in Product/Service.

Following are the Configurable Options available in Virtualizor WHMCS module.

  • Number of IPs
  • Number of IPv6 Address
  • Space
  • RAM
  • Bandwidth
  • CPU Cores
  • Network Speed
  • CPU Percent
  • Operating System
  • Control Panel
  • Server - Slave Server's Name in Virtualizor. Set the same values as you would with the Slave Server described in Module Settings
  • Region - Server Groups Name in Virtualizor. Set the same values as you would with the Server Group described in Module Settings

Other Advance Configurable Options

  • virtio
  • nic_type
  • vif_type
  • osreinstall_limit
  • kvm_cache
  • io_mode
  • iso - ISO
  • sec_iso - Secondary ISO
  • mgs - Media Groups (NOTE : Put ID of the Media Group for this configurable option.
    You can get it from Virtualizor Admin panel-> Media -> Media Groups )
  • stid - Storage to use
  • ippoolid - IP Pool ID, for selecting IPs from particular IP Pool. (NOTE: You can specify multiple IP Pool Ids with comma separated)
  • dnsplid - Setting DNS Plans

To add, go to WHMCS Admin Panel -> Setup -> Products/Services -> Configurable Options. Then click on Create a new Group


Configoptions.GIF

Now, click on the Add New Configurable Option button. A new window will open.

Number of IPs

Add a configurable option for Number of IPs as below:
Configoptions-ips.gif


Space

Add a configurable option for Space (It will be in GIGABYTES e.g 10 = 10GB) as below:
Configoptions-space.gif

RAM

Add a configurable option for RAM (It will be in MEGABYTES e.g. 512 = 512MB) as below:
Configoptions-ram.gif

Bandwidth

Add a configurable option for Bandwidth (It will be in GIGABYTES e.g. 10 = 10GB) as below:
Configoptions-bandwidth.gif

CPU Cores

Add a configurable option for CPU Cores as below:
Configoptions-cores.gif


Network Speed

Add a configurable option for Network Speed (It will be in KILOBYTES e.g. 128 = 128KB/s) as below:
Configoptions-ns.gif

CPU Percent

Add a configurable option for CPU Percent as below:
Configoptions-percent.gif


Operating System

Add a configurable option for Operating System as below:
Os.png


Storage Type

Add a configurable option for stid as below:
Stid.png


Virtio

Add a configurable option for Virtio as below:
Virtio.png


Virtual Network Interface Type

Similarly, add a configurable option for the Virtual Network Interface Type as below:
Configoptions-nic type.gif


Virtual Network Interface Emulation Type

Similarly, add a configurable option for the Virtual Network Interface Emulation Type as below:
Configoptions-vif type.gif


OS Re-Install Limit

Similarly, add a configurable option for the OS Re-Install Limit as below:
Configoptions-osresintalllimit.gif


KVM Cache

Similarly, add a configurable option for the KVM Cache as below:
Configoptions-kvm cache.gif


I/O Policy

Similarly, add a configurable option for the I/O Policy as below:
Configoptions-io mode.gif


DNS Plans

Similarly, add a configuration option for the DNS Plan as below:
Dnsplan-1.png

VNC Console Keymap

Similarly, add a configurable option for the VNC Console Keymap as below:
Configoptions-keymap.gif

BuycPanel Licensing

Control Panel Configurable option for BuycPanel licensing :
Screenshot controlPanel.jpg

You can assign cPanel installation for your Virtualizor VPS. The above option allows you to display a dropdown of control panel list which can be selected by the user and the license will be automatically activated by BuycPanel.
NOTE : You must enter the BuycPanel Login and API Key in virtualizor_conf.php file.

Control Panel

Control Panel as an individual Configurable Option :
Control panel1.jpg Control panel2.jpg

The above will just have the control panel installed in the newly created VPS. It will not license the Control Panel. Please do not confuse with the BuycPanel option described above.

NOTE : The configurable option values should be exactly as mentioned in each configurable option above, if you want to add a description to the Configurable option then you need to add a "|" (pipe) after the value followed by the description. For example for a configurable option of disk space if you want to add a description like GB or TB it should look like "10 | 10 GB".

Custom Code Integration

If you want to add your custom code as a hook to execute after order processing, you can do it by putting your code custom.php. You have to put your code in virtualizor module directory (i.e. /path/to/whmcs/modules/servers/virtualizor/custom.php)
While handling the error please use the variable $custom_error

Callback

The callback feature (Admin Panel -> Configuration -> Master Settings -> Callback Settings) allows Virtualizor to notify WHMCS when a specific action is performed.

NOTE : This functionality requires Virtualizor version 2.8.5

Callback setting.png

The following actions are supported for VPS(s):

  • Suspend
  • Unsuspend
  • Terminate
  • Change Hostname
  • Change IP(s)

1) For callbacks to work edit the callback.php script within the /path/to/WHMCS/modules/servers/virtualizor/ folder on your WHMCS installation.
2) Edit the script and set the 3 required security variables:

   // Any Admin User in WHMCS
   $admin_user = "admin";

   // The Hash Key in WHMCS (As shown in Virtualizor Admin Panel -> Configuration -> Master Settings -> Callback Settings)
   $hash_key = "";

   // The Virtualizor Master IP
   $connection_ip = "";


3) For more security rename the script to a filename of your choice.

Disable Enduser Operations

Admin can disable some of the options related to Virtualizor Client operations from WHMCS Enduser panel.

  • Change Hostname
  • Backup/Restore
  • OS Reinstall
  • Control Panel Install


You need to do manual changes in Configuration file to disable the settings, Please open the configuration file "virtualizor_conf.php" provided with the module and change the values of respective fields. (See "Enable/Disable Display Enduser Operations" Section)


Email Templates

The following email template can be used in WHMCS to send details of the newly created VM :

Dear {$client_name},

We are glad to inform you that the virtual machine you ordered has been set up.

Manager Details
=============================
URL: https://your.master.domain.com:4083
Username: {$service_username}
Password: {$service_password}

Server Details
=============================
Hostname: {$service_domain}
Main IP: {$service_dedicated_ip} 
Root Password: {$service_password}
{if $service_assigned_ips}
IP Address Allotted:
{$service_assigned_ips}
{/if}

You can access your server over SSH. 
If you are a Windows user, you can use a free SSH client called Putty which can be downloaded from :
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

{$signature}

Firewall Port

Please make sure, that the whmcs server , master server and the slave servers have ports 4082,4083,4084 and 4085 opened.


Support


If you need any assistance then please contact Softaculous Virtualizor Support. Please send us a screenshot of the Module Settings and the Custom Fields you added to the Product.