BILLmanager 6 Startup, Advanced

Plesk module at work

Service activation 

After a client orders and pays for the service, BILLmanager will start the activation process that includes several steps: 

Checking a domain name

The system checks that the client has specified a domain name during the order. If he left the Domain names field blank, BILLmanager will generate a domain based on the template specified in the tariff configuration form. When the domain is generated automatically, the system will "remember" that it should be created on the special server for free domain names.

Allocating an IP address

If a service requires an IP address, it will be allocated from the IP pool in Plesk: Tools and settingsTools and resourcesIP addresses

Creating a user 

The system sends the API request to create a new user in Plesk. The following resources will be sent as request parameters:

  • new account login;
  • automatically generated a password;
  • tariff plan in Plesk;
  • resource limits associated with the newly created subscription;
  • "Hosting parameters" in Plesk — the parameters from the tariff plan settings in Plesk. 

After executing the request, the billing platform will keep in the database the information about the domain, domain name server, IP address, service id, and account login and password. 

Processing user creation results 

The user creation procedure in Plesk may fail with one of the following responses: 

  • ERROR Error: Type: 'exists' Object: 'user' Value: '<username>'. This username already exists in the system. The existing account will be used; 
  • ERROR Error: type: 'Plesk server result error. Error code: 1007. Error message: Incorrect name <domain name>. This domain name already exists.'. the WWW-domain already exists. A new user won't be created;
  • OK — the user has been created successfully.

If the billing platform doesn't get any response from Plesk, BILLmanager will try access Plesk 10 times, once in a second, and search for the username in the user list. If the user is found, the operation will complete successfully. Otherwise, the operation will fail (it will be added to the Current operations section with an error message).  

Activating the service 

The service status in BILLmanager will change to Active. The client will receive a service activation email.

Creating a free domain name

To create a subdomain record, the system sends the API request (domain.record.edit) to the server for free domain names. 

Synchronization

Plesk processing module synchronizes service statuses and resources (limits) after every change in the billing platform. The service in BILLmanager is bound to Plesk subscription by the username. The  Username field in Products Shared hosting corresponds to the username in Plesk.

The cron job cron processing.syncserver.cron starts the synchronization process.

/usr/local/mgr5/processing/pmplesk --command sync_server --module <id_processing_modules_Plesk>
Details

Service status synchronization

When synchronizing service statuses, the system will select all the services in BILLmanager connected to the Plesk processing module and compare the service status in BILLmanager with the subscription status in Plesk.

If the service is Active in BILLmanager, but the corresponding subscription is disabled in Plesk, the billing platform will activate it. If the service in BILLmanager is Suspended but the subscription is active in Plesk, the subscription suspension request will be sent.

Suspending the subscription in Plesk will also suspend the corresponding service in the billing platform.

Synchronization starts every day. 

Resource synchronization

Resources in BILLmanager must match the subscription limits in Plesk. Otherwise, BILLmanager will send the API-request to Plesk to change the subscriptions according to the settings in the billing platform.

Logs

The log of interaction between the billing platform and Plesk is saved in the  /usr/local/mgr5/var/pmplesk.log

You can identify certain operations in the log by using the following records:

  • 'processing/pmplesk --runningoperation <current operation id> --command open' — service activation.
  • 'processing/pmplesk --runningoperation <current operation id>  --command close'  service deactivation.
  • 'processing/pmplesk --command sync_server --module <processing module id>' — data synchronization.
  • 'processing/pmplesk --command stat --module <processing module id>' — statistics collection.

Statistics

Plesk processing module collects statistics for some resources.  Statistics is always collected for the previous day. 

The process starts with the cron job statdaily.cron.

Logs

The log of interaction between the billing system and Plesk is saved in the  /usr/local/mgr5/var/pmplesk.log

You can identify certain operations in the log by using the following records:

  • 'processing/pmplesk --runningoperation <current operation id> --command open' — service activation.
  • 'processing/pmplesk --runningoperation <current operation id>  --command close'  service deactivation.
  • 'processing/pmplesk --command sync_server --module <processing module id>' — data synchronization.
  • 'processing/pmplesk --command stat --module <processing module id>' — statistics collection.