Add / update / delete servers through ezeelogin API

How to add/delete/update servers using ezeelogin API

 

Login to Ezeelogin Gui > Open Settings >  API

 

 Add the details of API configurations and Make sure API is enabled in API settings for the API script to work.
 
  
 
 
 

An API script is provided for automating server add/edit/delete tasks in Ezeelogin. With the help of this script, you can integrate Ezeelogin with any 3rd party application managing your clients/customers. Also, make sure to  enable API .

 

The API script can be executed as:

 

[email protected]:~# php /usr/local/ezlogin/ezwapi.php [params...]

For  Help 

[email protected]:~# php /usr/local/ezlogin/ezwapi.php -help

Usage:

 

ezwapi.php -help <action>

action : API action (add_server/update_server/remove_server)

 

ADD SERVER 

 

[email protected]:~# php /usr/local/ezlogin/ezwapi.php -help add_server

Usage:

 

ezwapi.php add_server -api_url <API URL> -secret <API secret> -name <hostname> -password <password> -ip_address <IP address> -group <group> [-ssh_port <port>] [-ssh_user <username>] [-keep_password <Y/N/S>]

[-enable_ssh <Y/N/H>] [-cp <control panel>]

 

-api_url : The API URL

-secret : The API secret configured in web panel settings

-name : The server host name

-password : The server password

-ssh_key : The SSH private key file (optional)

-passphrase : The SSH key pass phrase (optional)

-ip_address : The server IP address

-ssh_port : The server SSH port (optional, use default if unspecified)

-ssh_user : The server SSH user (optional, use default if unspecified)

-switch_user : Switch to this user after login as SSH user (optional)

-switch_pass : Password for switch user (optional)

-switch_sudo : Y or N or E to escalate privilege with 'sudo su' or 'enable' (for Cisco devices) (optional, default: N = disabled)

-prompt1 : Unique string in shell prompt of SSH user (optional)

-prompt2 : Unique string in password prompt for su or sudo (optional, default: Password:)

-prompt3 : Unique string in shell prompt of root user (optional, required for sudo)

-group : The server group name

-keep_password : Y (keep given password), N (automatic) or S (keep server password as such - no verification) (optional, default: Y)

-enable_ssh : Y, N or H to enable/disable/via Host Node (optional, default: N)

-ishn : Y or N to make this a Host Node or not (optional, default: N)

-onhost : The name of Host Node (optional, default: N)

-cp : The control panel name (optional, use default if unspecified)

-dc : The datacenter name (optional, use default if unspecified)

-rc_host : The remote console host (optional)

-rc_user : The remote console user (optional)

-rc_pass : The remote console password (optional)

 

Example - ADD SERVER : 

[email protected]:~# php /usr/local/ezlogin/ezwapi.php add_server -api_url http://10.11.1.137/ezlogin -secret  [email protected]#$!   -name test.noc.com -password test123 -ip_address 10.11.1.138 -group test

 

UPDATE SERVER 

[email protected]:~# php /usr/local/ezlogin/ezwapi.php -help update_server

Usage:

 

ezwapi.php update_server -api_url <API URL> -secret <API secret> -name <hostname> [-newname <new hostname>] [-password <password>] [-ip_address <IP address>] [-ssh_port <port>] [-ssh_user <username>]

[-group <group>] [-keep_password <Y/N/S>] [-enable_ssh <Y/N>] [-cp <control panel>]

 

-api_url : The API URL

-secret : The API secret configured in web panel settings

-name : The server host name

-newname : The new host name (optional)

-password : The server password (optional)

-ssh_key : The SSH private key file (optional)

-passphrase : The SSH key pass phrase (optional)

-ip_address : The server IP address (optional)

-ssh_port : The server SSH port (optional)

-ssh_user : The server SSH user (optional)

-switch_user : Switch to this user after login as SSH user (optional)

-switch_pass : Password for switch user (optional)

-switch_sudo : Y or N or E to escalate privilege with 'sudo su' or 'enable' (for Cisco devices) (optional, default: N = disabled)

-prompt1 : Unique string in shell prompt of SSH user (optional)

-prompt2 : Unique string in password prompt for su or sudo (optional)

-prompt3 : Unique string in shell prompt of root user (optional, required for sudo)

-group : The server group name

-keep_password : Y (keep given password), N (automatic) or S (keep server password as such - no verification) (optional)

-enable_ssh : Y, N or H to enable/disable/via Host Node (optional)

-ishn : Y or N to make this a Host Node or not (optional)

-onhost : The name of Host Node (optional)

-cp : The control panel name (optional)

-dc : The datacenter name (optional)

-rc_host : The remote console host (optional)

-rc_user : The remote console user (optional)

-rc_pass : The remote console password (optional)

 

 Example - UPDATE SERVER

[email protected]:~#   php /usr/local/ezlogin/ezwapi.php update_server -api_url http://10.11.1.137/ezlogin -secret [email protected]#$! -name ez.test.com -password test123 -ip_address 10.11.1.138 -group test

DELETE SERVER

[email protected]:~# php /usr/local/ezlogin/ezwapi.php -help remove_server

Usage:

 

ezwapi.php remove_server -api_url <API URL> -secret <API secret> -name <hostname>

 

-api_url : The API URL

-secret : The API secret configured in web panel settings

-name : The server host name

 

Example - Delete Server

[email protected]:~# php /usr/local/ezlogin/ezwapi.php  remove_server -api_url http://10.11.1.137/ezlogin -secret  [email protected]#$! -name ez.test.com 

 

  

   Make sure API is enabled in API settings for the API script to work.
 
If you need to execute the API script from a server other than the Ezeelogin installed server(jump server), copy /usr/local/ezlogin/ezwapi.php and /usr/local/ezlogin/apilib file to the server which you want to execute. PHP should be installed on the server.
0 (0)
Article Rating (No Votes)
Rate this article
    Attached Files
    There are no attachments for this article.
    Related Articles RSS Feed