|
Written by Website Tutorials
|
|
Wednesday, 14 June 2006 |
The Event Manager is designed to help you organize data interchange between Plesk and external systems. It works the following way: you create a file 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.
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 batch file called test-handler.bat that looks as follows: ----------------------------------------------------------------------
echo "--------------" >> c:\windows\temp\event_handler.log
rem information on the event date and time
date /T >> c:\windows\temp\event_handler.log
rem information on the created client account
echo "client created" >> c:\windows\temp\event_handler.log
rem client's name
echo "name: %1" >> c:\windows\temp\event_handler.log
rem client's login
echo "login: %2" >> c:\windows\temp\event_handler.log
echo "--------------" >> c:\windows\temp\event_handler.log
----------------------------------------------------------------------
This script prints some information to a file so that we could control its execution. Suppose, that our script is located in the directory c:\program files\swsoft\plesk\scripts\. Let's register it by creating an event handler via the control panel: Select the Server shortcut in the navigation pane. Click the Event Manager icon on the Server administration page. The Event Manager page appears. Click the Add New Event Handler icon. The event handler setup page appears: Select the event, you wish to assign a handler to in the Event drop-down box. Select the priority for handler execution, or specify a custom value. To do this, select custom in the Priority drop-down list and type in the value. Note, 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). Select the system user, on behalf of which the handler will be executed. In the Command input field, specify the path to a file to be executed upon the selected event. In our example it is "c:\program files\swsoft\plesk\scripts\test-handler.bat" <new_contact_name> <new_login_name> Note that if directory names or the file name contains spaces, the path should be quoted. Click OK.
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 c:\windows\temp\event_handler.log: --------------
Sat Jun 26 21:46:34 NOVT 2004
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. In order to remove one or several event handlers, in the list of handlers select the corresponding checkboxes and click Remove selected. Available Event Handler Parameter TemplatesThe parameter templates that can be used when setting up an event handler are presented in the table below: 2.1. | Component name/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 | | | E-mail | 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 owner'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 | | | Microsoft FrontPage Support | old_fp_support | new_fp_support | | | Microsoft FrontPage over SSL Support | old_fpssl_support | new_fpssl_support | | | Microsoft FrontPage Authoring | old_fp_authoring | new_fp_authoring | | | Microsoft FrontPage Admin Login | old_fp_admin_login | new_fp_admin_login | | | Microsoft FrontPage 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_autorespon ders | new_maximum_mail_autorespon ders | | | Maximum Number of Mailing Lists | old_maximum_mail_lists | new_maximum_mail_lists | | | Maximum Number of Java Applications | old_maximum_tomcat_web_appli cations | new_maximum_tomcat_web_appli cations | | | 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_autorespon ders | new_maximum_mail_autorespon ders | | | Maximum Number of Mailing Lists | old_maximum_mail_lists | new_maximum_mail_lists | | | Maximum Number of Java Applications | old_maximum_tomcat_web_appli cations | new_maximum_tomcat_web_appli cations | | | 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 user account updated' |
|---|
| Allow domain user 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 | | | E-mail | 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 | | | E-mail | 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' |
|---|
| Disk space limit | old_maximum_disk_space | new_maximum_disk_space | required | | For the events 'Limit on traffic reached for the client account' |
|---|
| 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' |
|---|
| Disk space limit | old_maximum_disk_space | new_maximum_disk_space | | | For the event 'Limit on traffic reached for domain' |
|---|
| 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 | |
|