Event Manager Examples

 

 

Creating a Rule that Sends an Email Notification on File Upload

This rule will automatically send out an email to someone whenever a file is uploaded to a specific folder.

Adding the New Rule

  1. Go to the Event Rules page of the Event Manager
  2. Click the New button. The Add A New Event Rule dialog will appear.
  3. Select the File Transfer Event Rule Type for your new rule. This event type will cause the rule to be triggered whenever a file transfer takes place.
  4. Enter a name for your rule in the Rule Name edit box. For example, “Email on Upload”.
  5. Press the Add New Rule button on the Add A New Rule dialog to save and add the new Event Rule. The event rule will be selected and ready for editing on the Edit Rules page.
help-61
The Add New Rule dialog

Selecting a Rule Matching Mode

Select the Match If All Filters Match mode. Selecting this option means that this rule will only be triggered whenever the rule’s event occurs and if all of the conditions listed are fulfilled.

Adding the Rule Conditions

A rule’s actions are carried out whenever that rule’s event trigger happens. In this example, a File Transfer Event triggers our rule. To further limit this rule to only triggering when a file is uploaded to a specific folder, we need to add two conditions or filters to the rule.

  1. There needs to be filter that ensures this is an upload, and not a download. To limit this rule to only triggering on an upload, select the {{D}}, Is a Download, variable from the conditions drop-down list. Select Equals as the comparison, and set the value to false.
  2. We only want this rule to trigger whenever the file is uploaded to the /uploads/temp folder. Select the {{RFP}}, Remote File Path, variable from the conditions drop-down list. Select Starts With as the comparison, and set the value to /uploads/temp.

help-62

The Email on Upload example rule.

Adding the Rule Actions

When an event matches all of the conditions of a rule then the rule actions are carried out. In this case, we want to email someone when a user uploads a file to a specific folder.

  1. Add an Email Someone action
  2. Select an SMTP server as the operation sub-action (you add SMTP Servers on the Event Targets page)
  3. Enter the name and email of the person you wish to email when this rule triggers
  4. Enter the subject for the email, or leave it blank for the default email subject

 

Creating a Rule that Deletes a File after Download

This rule will automatically delete a file located in the /uploads/temp folder after it has been downloaded by a user named batch_process.

Adding the New Rule

  1. Go to the Event Rules page of the Event Manager
  2. Click the New button. The Add A New Event Rule dialog will appear.
  3. Select the File Transfer Event Rule Type for your new rule. This event type will cause the rule to be triggered whenever a file transfer takes place.
  4. Enter a name for your rule in the Rule Name edit box. For example, “Delete on Download”.
  5. Press the Add a New Rule button on the Add A New Rule dialog to save and add the new Event Rule. The event rule will be selected and ready for editing on the Edit Rules page.

Selecting a Rule Matching Mode

Select the Match If All Filters Match mode. Selecting this option means that this rule will only be triggered whenever the rule’s event occurs and if all of the conditions listed are fulfilled.

Adding the Rule Conditions

A rule’s actions are carried out whenever that rule’s event trigger happens. In this example, a File Transfer Event triggers our rule. To further limit this rule to only triggering when a file is uploaded to a specific folder, and by a specific user, we need to add three conditions or filters to the rule.

  1. There needs to be filter that ensures this is a download, and not an upload. To limit this rule to only triggering on a upload, select the {{D}}, Is a Download, variable from the conditions drop-down list. Select Equals as the comparison, and set the value to true.
  2. We also need a filter to ensure the rule only triggers when user batch_process uploads a file. Select the {{U}}, Username, variable from the conditions drop-down list. Select Equals as the comparison, and set the value to batch_process.
  3. Finally, we only want this rule to trigger whenever the file is uploaded from the /uploads/temp folder. Select the {{RFP}}, Remote File Path, variable from the conditions drop-down list. Select Starts With as the comparison, and set the value to /uploads/temp.

Adding the Rule Actions

When an event matches all of the conditions of a rule then the rule actions are carried out. In this case, we want to delete the downloaded file from the server when user batch_process downloads a file from a specific folder.

  1. Add a Launch a File Operation action
  2. Select Delete File as the operation sub-action
  3. Enter the variable {{LFP}} to delete the local file on the server

 

Transferring an Uploaded file to another Server

This rule will detect a file upload to the /uploads/temp folder by a user named batch_process, and will execute a batch file operation to upload the file to another server.

Adding the New Rule

  1. Go to the Event Rules page of the Event Manager
  2. Click the New button. The Add A New Event Rule dialog will appear.
  3. Select the File Transfer Event Rule Type for your new rule. This event type will cause the rule to be triggered whenever a file transfer takes place.
  4. Enter a name for your rule in the Rule Name edit box. For example, “Forward Uploaded File”.
  5. Press the Add a New Rule button on the Add A New Rule dialog to save and add the new Event Rule. The event rule will be selected and ready for editing on the Edit Rules page.

Selecting a Rule Matching Mode

Select the Match If All Filters Match mode. Selecting this option means that this rule will only be triggered whenever the rule’s event occurs and if all of the conditions listed are fulfilled.

Adding the Rule Conditions

A rule’s actions are carried out whenever that rule’s event trigger happens. In this example, a File Transfer Event triggers our rule. To further limit this rule to only triggering when a file is uploaded to a specific folder, and by a specific user, we need to add three conditions or filters to the rule.

  1. There needs to be a filter that ensures this is an upload and not a download. To limit this rule to only triggering on an upload, select the {{D}}, Is a Download, variable from the conditions drop-down list. Select Equals as the comparison, and set the value to false.
  2. We also need a filter to ensure the rule only triggers when user batch_process uploads a file. Select the {{U}}, Username, variable from the conditions drop-down list. Select Equals as the comparison, and set the value to batch_process.
  3. Finally, we only want this rule to trigger whenever the file is uploaded to the /uploads/temp folder. Select the {{RFP}}, Remote File Path, variable from the conditions drop-down list. Select Starts With as the comparison and set the value to /uploads/temp.

Adding an executable Target to the Event Targets page

In order to upload the file to another server, we will need to execute a program on the server machine that can be invoked by Cerberus to upload the file. There are several command line clients available for command line file uploading using a variety of protocols. CURL and Psftp are two popular command line clients for uploading and downloading files. For this rule, we will use CURL to upload the file using SSH SFTP to another folder. To use CURL as part of an event rule action, we need to first add it as an available Executable target on the Event Targets page.

  1. Go the the Event Targets page of the Event Manager
  2. Click the New button on the top-right corner of the Event Targets page
  3. Under the Executable Target field box, select the file path to the CURL executable
  4. Press the Add button to the right of the Executable Path edit box to add CURL as an available event rule action target

Adding the Rule Actions

When an event matches all of the conditions of a rule then the rule actions are carried out. In this case, we want to re-upload a newly uploaded file to another server using CURL.

  1. Add a Launch an Executable action
  2. Select CURL executable path as the operation sub-action
  3. Enter the command line:
    -k -u upload_user:test sftp://127.0.0.1/ftproot/test/{{LFN}} -T {{LFP}}

The above command line is CURL-specific, and says to login to the SFTP server at 127.0.0.1 and upload the file to /ftproot/test/ using the credentials upload_user and password test. The file name of the original uploaded file is appended to the remote path using the variable {{LFN}}, and the target file to be upload is referenced by the full local file path variable {{LFP}}. That is the full path to the file that was just uploaded – the file that kicked off this event.

 

Emailing a Session Report after a User Logs Off

The Logoff Event Rule has a special event action allowing an administrator to be emailed a report of all user file activity that occurred while a user was logged in. The Email a Session Report event action is only available with a rule that is triggered by a Logoff event. There are several prerequisites for this event action: The reporting database must be setup and statistics collection enabled. There must also be at least one SMTP server configured on the Event Targets page.

Adding the New Rule

  1. Go to the Event Rules page of the Event Manager
  2. Click the New button. The Add A New Event Rule dialog will appear.
  3. Select the Logoff Event Rule Type for your new rule. This event type will cause the rule to be triggered whenever a user logs out, or their session times out.
  4. Enter a name for your rule in the Rule Name edit box. For example, “Email a Session Report”.
  5. Press the Add A New Event Rule button on the Add A New Rule dialog to save and add the new Event Rule. The event rule will be selected and ready for editing on the Edit Rules page.

Adding the Rule Conditions

We will add a single condition to make sure this rule only triggers when the user test logs out.

  1. Select the {{U}}, Username, variable from the conditions dropdown list. Select Equals as the comparison, and set the value to test.

Adding the Rule Actions

You will need to add the Email Session Report action to have the system send a session report for the user after they log out.

  1. Select the Email Session Report action
  2. Enter the Email Name and Email Address of the person you wish to email, and an optional Email Subject for the session report email.
  3. Add the action to the rule.

A reporting database must be setup, and statistics collection enabled on the Reporting page of the Server Manager for Session Reporting emails to work.