- This line was added.
- This line was removed.
- Formatting was changed.
Store Store the
Remote module as a file with the
.pm extension in the
/usr/local/cpanel/Cpanel/NameServer/Remote/ directory, which corresponds to the
You can find additional example modules in the
/usr/local/cpanel/Cpanel/NameServer/Remote/ directory on your cPanel & WHM server.
When you write a
Remote module, you can use the following variables in your code:
The access hash password in the DNS configuration file in the
represents the authenticated WHM account's username.
To create or view an access hash, use WHM's Remote Access Key interface (WHM >> Home >> Clusters >> Remote Access Key).
|The remote server's DNS role.|
|The host to which the module connects.|
|The amount of time to wait to send an HTTP request before the system times out, in seconds.|
|The time at which the user called the DNS command, in Unix time format.|
A subroutine reference that handles display data.
A subroutine reference to the subroutine that manages queue requests.
|The amount of time to wait to receive an HTTP request before the system times out, in seconds.|
|The timeout to use.|
The user's API token.
To create or view an API token, use WHM's Manage API Tokens interface (WHM >> Home >> Security Center >> Manage API Tokens).
|The type of update.|
|The username in the DNS configuration file in the |
Each command method must use the following parameters:
|The command's unique identifier, which the method should use to ensure that the same system does not receive a command twice.|
|A hash reference that contains a serialized version of arguments that the method passed to the command.|
|A hash reference that contains a raw URL version of the arguments that the method passed to the system.|
For this reason, we recommend that you begin each method with the following line of code:
my ( $self, $dnsuniqid, $dataref, $rawdata ) = @_;
dnsadmin system returns data as output and parameters, because the system executes processes through output data. The base class implements this output as the
output() subroutine. This subroutine relies on the
output_callback value that your module passes with the
bless function into the
Command methods return a hash that contains two values:
|string||A constant that the |
This value must be
|string||A message of success, or a reason for failure.|
_check_action() subroutine returns proper data constants when the
dnsadmin system sends or receives information. This subroutine checks remote systems' HTTP statuses, and determines whether the system can recover from errors.
Calls to this subroutine resemble the following examples:
_check_action($msg, $Cpanel::NameServer::Constants::QUEUE); _check_action($msg, $Cpanel::NameServer::Constants::DO_NOT_QUEUE);
In these examples, the
DO_NOT_QUEUE constants determine whether the system queues an action if it fails.
QUEUEconstant retries a failed action if the system determines that the action is recoverable.
DO_NOT_QUEUEconstant returns an error message for a failed action, and does not attempt to retry the action.
You must implement each command that you pass to the
dnsadmin system as a subroutine in your
For more information about the required and optional command methods, read our Remote Module Command Methods documentation.
You must include the following required methods in your module:
Select the tab below for the desired cPanel & WHM version: