The Event Manager is designed to help you organize data interchange between Plesk and external systems. It works the following way: you create a script to be executed upon a certain control panel event, and then create an event handler that triggers the event processing. You can assign several handlers to a single event.
Important: Plesk administrator can create the event handlers that will be run on the server on behalf of user root. If you wish to restrict usage of the root account, create an empty file with name root.event_handler.lock
in the location /plesk_installation_directory/var/
.
To add an Event Handler:
For instance, let's create an event handler for the 'client account creation' event. The handler will accept a client name as the first parameter, and the client's login as the second. For simplicity we will use a shell-script called test-handler.sh
that looks as follows:
#!/bin/bash
echo "--------------" >> /tmp/event_handler.log
/bin/date >> /tmp/event_handler.log # information on the event date and time
/usr/bin/id >> /tmp/event_handler.log # information on the user, on behalf of which the script was executed (to ensure control)
echo "client created" >> /tmp/event_handler.log # information on the created client account
echo "name: $1" >> /tmp/event_handler.log # client's name
echo "login: $2" >> /tmp/event_handler.log # client's login
echo "--------------" >> /tmp/event_handler.log
This script prints some information to a file so that we could control its execution (we cannot output information to stdout/stderr, as the script is executed in the background mode).
Suppose, that our script is located in the directory /plesk_installation_directory
/bin
(for instance). Let's register it by creating an event handler via the control panel:
When assigning several handlers to a single event you can specify the handler execution sequence, setting different priorities (higher value corresponds to a higher priority).
/usr/local/psa/bin/test-handler.sh <new_contact_name>
<new_login_name>
.Note: In the command we have specified the parameters in the angle brackets <new_contact_name>
and <new_login_name>
. Before executing the handler, they will be replaced with name and login of the created client respectively. The entire list of available parameters is provided in the following section. You should keep in mind that with the removal operations, the parameters of type new_xxx contain an empty string. And with creation operations the parameters of type old_xxx contain an empty string.
Now if you login to your Plesk control panel and create a new client, specifying the value 'Some Client' in the Contact name field, and 'some_client' in the field Login, the handler will be invoked, and the following records will be added to the /tmp/event_handler.log
:
Sat Jun 26 21:46:34 NOVT 2004
uid=0(root) gid=0(root) groups=0(root)
client created
name: Some client
login: some_client
If you want to specify one or few handlers more, repeat the actions above for another handler.
To remove an Event Handler:
The parameter templates that can be used when setting up an event handler are presented in the table below:
Table. Available Event Handler Parameter Templates
Component name and description |
Command line parameter |
Notes |
|
Old component value |
New component value |
||
For the events 'Client account created', 'Client account updated', 'Client account removed' |
|||
Login Name |
old_login_name |
new_login_name |
required |
Contact Name |
old_contact_name |
new_contact_name |
required |
Company Name |
old_company_name |
new_company_name |
|
Phone |
old_phone |
new_phone |
|
Fax |
old_fax |
new_fax |
|
old_email |
new_email |
|
|
Address |
old_address |
new_address |
|
City |
old_city |
new_city |
|
State/Province |
old_state_province |
new_state_province |
|
Postal/ZIP Code |
old_postal_zip_code |
new_postal_zip_code |
|
Country |
old_country |
new_country |
|
For the events 'Domain created', 'Domain updated', 'Domain deleted' |
|||
---|---|---|---|
Domain Name |
old_domain_name |
new_domain_name |
required |
For the events 'Subdomain created', 'Subdomain updated', 'Subdomain deleted' |
|||
Subdomain Name |
old_subdomain_name |
new_subdomain_name |
required |
Parent Domain Name |
old_domain_name |
new_domain_name |
required |
FTP account |
old_system_user_type |
new_system_user_type |
|
Subdomain administrator's login name |
old_system_user |
new_system_user |
|
Hard disk quota |
old_hard_disk_quota |
new_hard_disk_quota |
|
SSI support |
old_ssi_support |
new_ssi_support |
|
PHP support |
old_php_support |
new_php_support |
|
CGI support |
old_cgi_support |
new_cgi_support |
|
Perl support |
old_mod_perl_support |
new_mod_perl_support |
|
Python support |
old_mod_python_support |
new_mod_python_support |
|
ColdFusion support |
old_coldfusion_support |
new_coldfusion_support |
|
Apache::ASP support |
old_apache_asp_support |
new_apache_asp_support |
|
SSL support |
old_ssl_support |
new_ssl_support |
|
For the events 'Physical hosting created', 'Physical hosting updated' |
|||
Domain Name |
old_domain_name |
new_domain_name |
required |
IP Address |
old_ip_address |
new_ip_address |
|
IP Type |
old_ip_type |
new_ip_type |
|
System User |
old_system_user |
new_system_user |
|
System User Password |
old_system_user_password |
new_system_user_password |
|
Shell Access |
old_system_shell |
new_system_shell |
|
FP Support |
old_fp_support |
new_fp_support |
|
FP-SSL Support |
old_fpssl_support |
new_fpssl_support |
|
FP Authoring |
old_fp_authoring |
new_fp_authoring |
|
FP Admin Login |
old_fp_admin_login |
new_fp_admin_login |
|
FP Admin Password |
old_fp_admin_password |
new_fp_admin_password |
|
SSI Support |
old_ssi_support |
new_ssi_support |
|
PHP Support |
old_php_support |
new_php_support |
|
CGI Support |
old_cgi_support |
new_cgi_support |
|
Mod Perl Support |
old_mod_perl_support |
new_mod_perl_support |
|
Apache ASP Support |
old_apache_asp_support |
new_apache_asp_support |
|
SSL Support |
old_ssl_support |
new_ssl_support |
|
Web Statistics |
old_web_statistics |
new_web_statistics |
|
Custom Error Documents |
old_apache_error_documents |
new_apache_error_documents |
|
Hard Disk Quota |
old_hard_disk_quota |
new_hard_disk_quota |
|
For the event 'Physical hosting deleted' |
|||
Domain Name |
old_domain_name |
new_domain_name |
required |
For the events 'Mail name created', 'Mail name deleted' |
|||
Mail name |
old_mailname |
new_mailname |
required (in the format mailname@domain) |
For the event 'Mail name updated' |
|||
Mail name |
old_mailname |
new_mailname |
required (in the format mailname@domain) |
Mailbox |
old_mailbox |
new_mailbox |
|
Password |
old_password |
new_password |
|
Mailbox Quota |
old_mailbox_quota |
new_mailbox_quota |
|
Redirect |
old_redirect |
new_redirect |
|
Redirect Address |
old_redirect_address |
new_redirect_address |
|
Mail Group |
old_mail_group |
new_mail_group |
|
Autoresponders |
old_autoresponders |
new_autoresponders |
|
Mail User Control Panel Access |
old_mail_controlpanel_access |
new_mail_controlpanel_access |
|
For the event 'Web user deleted' |
|||
Domain Name |
old_domain_name |
new_domain_name |
required |
Web user Name |
old_webuser_name |
new_webuser_name |
required |
For the events 'Web user created', 'Web user updated' |
|||
Domain Name |
old_domain_name |
new_domain_name |
required |
Web User Name |
old_webuser_name |
new_webuser_name |
required |
Web User Password |
old_webuser_password |
new_webuser_password |
|
SSI Support |
old_ssi_support |
new_ssi_support |
|
PHP Support |
old_php_support |
new_php_support |
|
CGI Support |
old_cgi_support |
new_cgi_support |
|
Mod Perl Support |
old_mod_perl_support |
new_mod_perl_support |
|
Mod Python Support |
old_mod_python_support |
new_mod_python_support |
|
Apache ASP Support |
old_apache_asp_support |
new_apache_asp_support |
|
Hard Disk Quota |
old_hard_disk_quota |
new_hard_disk_quota |
|
For the event 'Client limits updated' |
|||
Contact Name |
old_contact_name |
new_contact_name |
required |
Maximum Number of Domains |
old_maximum_domains |
new_maximum_domains |
|
Maximum Amount of Disk Space |
old_maximum_disk_space |
new_maximum_disk_space |
|
Maximum Amount of Traffic |
old_maximum_traffic |
new_maximum_traffic |
|
Maximum Number of Web Users |
old_maximum_webusers |
new_maximum_webusers |
|
Maximum Number of Databases |
old_maximum_databases |
new_maximum_databases |
|
Maximum Number of Mailboxes |
old_maximum_mailboxes |
new_maximum_mailboxes |
|
Mailbox Quota |
old_maximum_mailbox_quota |
new_maximum_mailbox_quota |
|
Maximum Number of Mail Redirects |
old_maximum_mail_redirects |
new_maximum_mail_redirects |
|
Maximum Number of Mail Groups |
old_maximum_mail_groups |
new_maximum_mail_groups |
|
Maximum Number of Mail Autoresponders |
old_maximum_mail_autoresponders |
new_maximum_mail_autoresponders |
|
Maximum Number of Mailing Lists |
old_maximum_mail_lists |
new_maximum_mail_lists |
|
Maximum Number of Java Applications |
old_maximum_tomcat_web_applications |
new_maximum_tomcat_web_applications |
|
Expiration Date |
old_expiration_date |
new_expiration_date |
|
For the event 'Domain limits updated' |
|||
Domain Name |
old_domain_name |
new_domain_name |
required |
Maximum Amount of Disk Space |
old_maximum_disk_space |
new_maximum_disk_space |
|
Maximum Amount of Traffic |
old_maximum_traffic |
new_maximum_traffic |
|
Maximum Number of Web Users |
old_maximum_webusers |
new_maximum_webusers |
|
Maximum Number of Databases |
old_maximum_databases |
new_maximum_databases |
|
Maximum Number of Mailboxes |
old_maximum_mailboxes |
new_maximum_mailboxes |
|
Mailbox Quota |
old_maximum_mailbox_quota |
new_maximum_mailbox_quota |
|
Maximum Number of Mail Redirects |
old_maximum_mail_redirects |
new_maximum_mail_redirects |
|
Maximum Number of Mail Groups |
old_maximum_mail_groups |
new_maximum_mail_groups |
|
Maximum Number of Mail Autoresponders |
old_maximum_mail_autoresponders |
new_maximum_mail_autoresponders |
|
Maximum Number of Mailing Lists |
old_maximum_mail_lists |
new_maximum_mail_lists |
|
Maximum Number of Java Applications |
old_maximum_tomcat_web_applications |
new_maximum_tomcat_web_applications |
|
Expiration Date |
old_expiration_date |
new_expiration_date |
|
For the events 'Mailing list created', 'Mailing list updated', 'Mailing list deleted' |
|||
Domain Name |
old_domain_name |
new_domain_name |
required |
Mailing list name |
old_mail_list_name |
new_mail_list_name |
required |
Mailing list enabled |
old_mail_list_enabled |
new_mail_list_enabled |
|
For the events 'Control panel user logged in', 'Control panel user logged out' |
|||
Contact Name |
old_contact_name |
new_contact_name |
|
For the event 'Domain administrator account updated' |
|||
Allow domain administrator access |
old_allow_domain_user_access |
new_allow_domain_user_access |
|
Login Name |
old_login_name |
new_login_name |
required |
Domain Name |
old_domain_name |
new_domain_name |
required |
Contact Name |
old_contact_name |
new_contact_name |
|
Company Name |
old_company_name |
new_company_name |
|
Phone |
old_phone |
new_phone |
|
Fax |
old_fax |
new_fax |
|
old_email |
new_email |
|
|
Address |
old_address |
new_address |
|
City |
old_city |
new_city |
|
State/Province |
old_state_province |
new_state_province |
|
Postal/ZIP Code |
old_postal_zip_code |
new_postal_zip_code |
|
Country |
old_country |
new_country |
|
For the events 'Site application installed', 'Site application reconfigured', Site application uninstalled' |
|||
Site application package name |
old_site_application_package_name |
new_site_application_package_name |
required |
Domain type (domain or subdomain) |
old_site_application_domain_type |
new_site_application_domain_type |
required |
Installation path (httpdocs or httpsdocs) |
old_site_application_directory |
new_site_application_directory |
required |
Installation path within the destination directory |
old_site_application_installation_prefix |
new_site_application_installation_prefix |
required |
For the events 'Site application package installed', 'Site application package uninstalled' |
|||
Site application package name |
old_site_application_package_name |
new_site_application_package_name |
required |
For the events 'Service stopped, started, or restarted' |
|||
Service |
old_service |
new_service |
required |
For the events 'IP address created, changed, or deleted' |
|||
IP address |
old_ip_address |
new_ip_address |
required |
IP mask |
old_ip_mask |
new_ip_mask |
|
Interface |
old_interface |
new_interface |
|
IP type |
old_ip_type |
new_ip_type |
|
For the events 'Forwarding created, changed, deleted' |
|||
Domain name |
old_domain_name |
new_domain_name |
required |
Forwarding type |
old_forwarding_type |
new_forwarding_type |
|
URL |
old_url |
new_url |
|
For the event 'Administrator information changed' |
|||
Login name |
old_login_name |
new_login_name |
required |
Contact name |
old_contact_name |
new_contact_name |
|
Company name |
old_company_name |
new_company_name |
|
Phone number |
old_phone |
new_phone |
|
Fax |
old_fax |
new_fax |
|
old_email |
new_email |
|
|
Address |
old_address |
new_address |
|
CIty |
old_city |
new_city |
|
State/Province |
old_state_province |
new_state_province |
|
Postal/Zip code |
old_postal_zip_code |
new_postal_zip_code |
|
Country |
old_country |
new_country |
|
For the events 'Site application installed, reconfigured, uninstalled' |
|||
Site application name |
old_package_name |
new_package_name |
required |
For the events 'Client status updated' |
|||
Contact name |
old_contact_name |
new_contact_name |
required |
Login name |
old_login_name |
new_login_name |
required |
Status |
old_status |
new_status |
|
For the events 'Client preferences updated' |
|||
Contact name |
old_contact_name |
new_contact_name |
required |
Login name |
old_login_name |
new_login_name |
required |
Page size |
old_lines_per_page |
new_lines_per_page |
|
Interface skin |
old_interface_skin |
new_interface_skin |
|
For the event 'Client's IP pool changed' |
|||
Contact name |
old_contact_name |
new_contact_name |
required |
IP address |
old_ip_address |
new_ip_address |
required |
Status |
old_status |
new_status |
|
For the event 'Limit on disk space reached for the client account' |
|||
Contact name |
old_contact_name |
new_contact_name |
required |
Disk space limit |
old_maximum_disk_space |
new_maximum_disk_space |
required |
For the events 'Limit on traffic reached for the client account' |
|||
Contact name |
old_contact_name |
new_contact_name |
required |
Traffic limit |
old_maximum_traffic |
new_maximum_traffic |
|
For the events 'Domain status changed' |
|||
Domain name |
old_domain_name |
new_domain_name |
required |
Domain status |
old_status |
new_status |
|
For the event 'DNS zone updated for domain' |
|||
Domain name |
old_domain_name |
new_domain_name |
required |
For the event 'Limit on disk space reached for domain' |
|||
Domain name |
old_domain_name |
new_domain_name |
required |
Disk space limit |
old_maximum_disk_space |
new_maximum_disk_space |
|
For the event 'Limit on traffic reached for domain' |
|||
Domain name |
old_domain_name |
new_domain_name |
required |
Traffic limit |
old_maximum_traffic |
new_maximum_traffic |
|
For the event 'License key update' |
|||
License key number |
old_license |
new_license |
required |
License key type (Plesk, additional) |
old_license_type |
new_license_type |
|
License key name (for additional keys) |
old_license_name |
new_license_name |
|